question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can only update a mounting component. This usually means you called setState() outside componentWillMount() on the server. This is a no-op.

See original GitHub issue

Are you submitting a bug report or a feature request?

Bug report. I have a problem on the SSR

Warning: setState(...): Can only update a mounting component. This usually means you called setState() outside componentWillMount() on the server. This is a no-op.
Please check the code for the ReactFinalForm(4.2.0)(undefined) component.

What’s your environment?

FinalForm v4.2.1 ReactFinalForm v3.1.2 React v16.2.0 node v8.9.4

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
thomhoscommented, Mar 14, 2018

Can confirm, works great now.

1reaction
thomhoscommented, Mar 14, 2018

In my case I’m not using nextjs. My flow looks like this;

  1. Apollo’s getDataFromTree
  2. renderToString
  3. Pass the resulting string into glamor’s renderStatic
  4. Pass the data, markup to an HTML component and render that to string

If I remove apollo (step 1), the renderStatic (step 3) and second render to string (step 4) the warning still persists.

I’ve found it only appears when using a Field component. Stripping the field components of props also doesn’t help; both a field with a render function that returns a custom component and just a component='input' prop trigger the warning.

Read more comments on GitHub >

github_iconTop Results From Across the Web

setState(...): Can only update a mounted or ... - Stack Overflow
Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a...
Read more >
Prevent React setState on unmounted Component
Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted ...
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 >
React setState usage and gotchas - ITNEXT
setState() will always lead to a re-render unless shouldComponentUpdate() returns false . To avoid unnecessary renders, calling setState() only when the new ...
Read more >
Can only update a mounting component. This usually means ...
Can only update a mounting component. This usually means you called setState() outside componentWillMount() on the server. This is a no-op.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found