WebReflection / augmentor

Extensible, general purpose, React like hooks for the masses.
https://medium.com/@WebReflection/demystifying-hooks-f55ad885609f
ISC License
134 stars 7 forks source link

useState lazy init #19

Closed dy closed 5 years ago

dy commented 5 years ago

According to the useState docs, it can be initialized with the function.

let [value, setValue] = useState(() => initialValue)
// typeof value === 'function'
// but must be initialValue

Augmentor doesn't seem to support that for now.

Sandbox

WebReflection commented 5 years ago

Thanks, and this is trivial too. Do you know if other hooks have the same so I can release a version that lazy initialize them all?

WebReflection commented 5 years ago

Never mind, I've read through and that's the only lazy value to initialize. Published as 1.1.5