mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +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);
|
const local_storage_value_str = localStorage.getItem('state:' + id);
|
||||||
// If there is a value stored in localStorage, use that
|
// If there is a value stored in localStorage, use that
|
||||||
if (local_storage_value_str) {
|
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
|
// Otherwise use initial_value that was passed to the function
|
||||||
return initial_value;
|
return initial_value;
|
||||||
|
|||||||
Reference in New Issue
Block a user