9.19 throws setState(...): You passed an undefined or null state object; instead, use forceUpdate()
See original GitHub issueUpgrading to 9.19 started throwing a React warning with React 15.6:
Warning: setState(...): You passed an undefined or null state object; instead, use forceUpdate()
I’m using it like this:
import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer'
import List from 'react-virtualized/dist/commonjs/List'
@observer
export class FeatureList extends React.Component {
rowRenderer({ key, index, style }) {
return <FeatureListItem key={key} style={style} feature={featureStore.featureArray[index]} />
}
render() {
if (!mapUIStore.ready) return null
return (
<ul id="panel-items-list">
<AutoSizer>
{({ height, width }) => (
<Observer>
{() => (
<List
width={width}
height={height}
rowCount={featureStore.count}
rowHeight={31}
rowRenderer={this.rowRenderer}
scrollToIndex={mapUIStore.scrollToIndex}
/>
)}
</Observer>
)}
</AutoSizer>
</ul>
)
}
}
The warning happens when scrollToIndex is updated.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top Results From Across the Web
React setState(null) and force update - Stack Overflow
Do consider working around the need to imperatively force a state update where possible. function useForceUpdate() { const [i, setI] = React.
Read more >null vs. undefined: Can I use only one? | by OOO - Medium
At first, I used both because they have different definition · undefined — a non-value that you don't explicitly assign. · null —...
Read more >react-virtualized | Yarn - Package Manager
Grid and Collection components can be forcefully re-rendered using forceUpdate . For Table and List , you'll need to call forceUpdateGrid to ensure...
Read more >How to work with React the right way to avoid some common ...
Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application....
Read more >Team:Austin LASA/team team members2.html - iGEM 2018
"undefined" && DEBUG) {\n\t\tif (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser ...
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
Yep this is a breaking change. Try to fix it. We will return null in v10.
Gotcha