mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
maintain return type
This commit is contained in:
@@ -9,7 +9,7 @@ export const usePersistState = <T>(
|
||||
const local_storage_value_str = localStorage.getItem('state:' + id);
|
||||
// If there is a value stored in localStorage, use that
|
||||
if (local_storage_value_str) {
|
||||
return JSON.parse(local_storage_value_str);
|
||||
return JSON.parse(local_storage_value_str) as T;
|
||||
}
|
||||
// Otherwise use initial_value that was passed to the function
|
||||
return initial_value;
|
||||
|
||||
Reference in New Issue
Block a user