#581·recompose

Getting an error server side rendering a withState component

Author: abhiaiyer91Created Dec 28, 2017Updated Jun 5, 2020

Hello!

I have a component that uses withState like so:

javascript
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?