Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't update my component (warning Using UNSAFE_componentWillReceiveProps) #2485

Closed
2 of 3 tasks
santiago-pat opened this issue Jul 26, 2021 · 7 comments
Closed
2 of 3 tasks

Comments

@santiago-pat
Copy link

santiago-pat commented Jul 26, 2021

Prerequisites

Description

I am having a problem changing the schema in my implementation, I am trying to make a form with several pages, I created the schema variable based on React.UseEffect and when executing setSchema (method to update the state) my component does not render again, but if you change the variable, has anyone had this problem? also when running the application I get a warning (image attached)

image

Expected behavior

[What you expected to happen]

Actual behavior

[What actually happened]

Version

You can usually get this information in your package.json or in the file URL if you're using the unpkg one.

@mberlanda
Copy link

Posting the warning as a text so it is searchable:

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: Form

@wirekang
Copy link

Same here.

@ChocolateLoverRaj
Copy link
Contributor

@jacqueswho how is this a question this is a bug.

@heath-freenome
Copy link
Member

Fixed in the v5 beta, see the 5.x migration guide

@nlarusstone
Copy link

This doesn't appear to be fixed for me (and several others in #1794 -- though perhaps that's a better ticket to track this)

@heath-freenome
Copy link
Member

@nlarusstone are we will worried about the warning? Hopefully we will fix this in RJSF 6. OR are you trying to use react 18 in strict mode?

@nlarusstone
Copy link

Ah this is a good point -- I was using react 18 in dev (strict mode) which would explain this.

I've just been ignoring the warning, but would be nice to have it fixed. If it takes until RJSF 6, that's ok -- thanks for the heads up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants