Support for complex types of state values
See original GitHub issueHello,
First - thanks for this nice library.
I have one problem with state and Date.
Simple component:
export function DateComponent() {
const date = useState<Date>(new Date());
return <div>{date.get().toString()}</div>;
}
Returns
TypeError
_this.child(...).get is not a function
Problem is default value (new Date())
Is this bug or I miss something?
Btw after some investigation -
date.attach(Downgraded);
works fine.
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Complex Data Types - Oracle Help Center
Complex Data Types. An instance of a complex data type contains multiple values and provides access to its nested values. Currently, Oracle NoSQL...
Read more >5 Best Practices for Handling State Structure in React
Although it's possible to write working code even with a standard state structure, here are a few steps to help you make better...
Read more >Programming with State: Values and Entities - Futurice
A view that I've found useful is to divide the objects manipulated by the program into two kinds, values and entities. A value...
Read more >Introduction to data types and field properties - Microsoft Support
Overview of data types and field properties in Access, and detailed data type reference. including Memo, Date/Time, and Text.
Read more >Supported Data Types - Trifacta Documentation
Values of these data types are three-digit numeric values, which correspond to recognized HTTP Status Codes. Datetime Data Type, Designer Cloud ...
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 Free
Top 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

Ok. I will check how to improve this doc. I have also experimented with adding support for Date and other complex JS types. It is possible to make it work for the @hookstate/core. But it is a problem for some plugins, as complex JS types are not JSON serializable - which is a weakness of the JS language itself. Not sure if adding this support is valuable. Until now I managed to work around this language limitation using plain strings…
No problem; it’s pretty easy to miss as it’s a small section at the end of a very long page.
@avkonst Perhaps move the limitations section to its own category in the docs?