Getting an error server side rendering a withState component
Hello!
I have a component that uses withState like so:
withState('item', 'setItem', ({ val }) => {
return val;
})
Having upgraded to recompose 0.26.0 and React 16.2.0, i'm getting an error here
https://github.com/acdlite/recompose/blob/master/src/packages/recompose/withState.js#L21
Where my app is destructuring stateValue, but in the case I'm experiencing prevState is null!
does React guarantee prevState as an object?
Any ideas?
@abhiaiyer91 are you sure you're passing correct props for the component? and it's not getting null for first render?
Real example? As stateValue is always defined for state https://github.com/acdlite/recompose/blob/master/src/packages/recompose/withState.js#L12-L13
Getting the same error on server-rendering with after.js
@panayi can you provide some example code to reproduce the issue?
Hi, i'm want to ask is there a way that does not cause errors to use withState more than 1 time?
and can you provide an example?
thankyou