Support passing object as initial value
See original GitHub issueWant to support object as initial value. Example:
const [item, setItem] = useLocalStorage('name', {key: 'value'});
then item
value should be an object also
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Setting default value for TypeScript object passed as ...
Writing an interface, type or class for the parameter object improves legibility. type FullName = { firstName: string; /** @defaultValue 'Smith' */ lastName...
Read more >Default parameters - JavaScript - MDN Web Docs
Default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.
Read more >Understanding Default Parameters in JavaScript
Any primitive value or object can be used as a default parameter value. In this section, you will see how this flexibility increases...
Read more >Initialize Property Values - MATLAB & Simulink
Define properties with default values — MATLAB ® assigns the same initial value to the property of every instance. Set property values in...
Read more >ref keyword - C# Reference
The storage location of the object is passed to the method as the value of the reference parameter. If you change the value...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is my go to lib for lots of hooks. This one already supports complex objects via serialization. https://github.com/streamich/react-use/blob/master/src/useLocalStorage.ts
@dance2die, @lilasquared, @TheAifam5 , @SeanMcP , @VitorLuizC, @evgenymarkov,
can you please verify this PR