bietkul / react-reactive-form

Angular like reactive forms in React.
MIT License
309 stars 32 forks source link

Warning: Legacy context API has been detected within a strict-mode tree. #65

Closed devnoot closed 4 years ago

devnoot commented 4 years ago
Warning: Legacy context API has been detected within a strict-mode tree.

The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.

Please update the following components: FieldControl, FieldGroup
bietkul commented 4 years ago

@devnoot This issue has been fixed in the latest version, can you please share a code sandbox link reproducing the issue. Thanks

Kanaan-Abdulbaqi91 commented 4 years ago

I have the same issue

bietkul commented 4 years ago

I don't see it here with latest version. Please share the replicable example.

Kanaan-Abdulbaqi91 commented 4 years ago

I don't see it here with latest version. Please share the replicable example.

I created a new project via "npx create-react-app my-app --template typescript" command and added the code you mentioned above to App component and I was able to reproduce the issue.

Thanks for your time and effort.

ivan-ponomarev commented 3 years ago

I don't see it here with latest version. Please share the replicable example.

You need to enable React.StrictMode in order to see the warning.

Try to change the last line in your example to the following:

render(<React.StrictMode><SimpleForm /></React.StrictMode>, document.getElementById("root"));

The warning starts to appear:

Warning: Legacy context API has been detected within a strict-mode tree.

The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.

Please update the following components: FieldControl, FieldGroup

Learn more about this warning here: https://fb.me/react-legacy-context
    in FieldGroup (created by SimpleForm)
    in div (created by SimpleForm)
    in SimpleForm
    in StrictMode