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

[Alert.js/Transition] Legacy context API has been detected within a strict-mode tree #1837

Closed
Nik-Novak opened this issue May 18, 2020 · 5 comments

Comments

@Nik-Novak
Copy link

  • components: Transition (from Alert.js)
  • reactstrap version #8.4.1
  • import method umd/csj/es
  • react version #16.13.1
  • bootstrap version #4.5.0

What is happening?

Using an alert and Strict mode results in this heavy handed warning:

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: Transition

Learn more about this warning here: https://fb.me/react-legacy-context
    in Transition (created by Fade)
    in Fade (created by Alert)
    in Alert (at PageMain.jsx:30)
    in section (at PageMain.jsx:29)
    in PageMain (created by Context.Consumer)
    in Route (at Menu.jsx:12)
    in Switch (at Menu.jsx:11)
    in div (at Menu.jsx:10)
    in Menu (at App.jsx:8)
    in App (at src/index.js:14)
    in Router (created by BrowserRouter)
    in BrowserRouter (at src/index.js:13)
    in StrictMode (at src/index.js:12)

What should be happening?

No deprecated lifecycle methods should be used

Steps to reproduce issue

  1. default create-react-app project
  2. Install reactstrap according to guide
  3. Create an Alert element such as:
<Alert color="warning" className='alert-main' isOpen={version.local!=version.remote && showVersionAlert} toggle={()=>setShowVersionAlert(false)}>
        Your version of {name} is out of date. Would you like to update? 
        <br/> Your version: {version.local} 
        <br/> Latest: {version.remote} <Button className="alert-button" nav="/update">Update</Button>
      </Alert>

Error message in console

See above

Code

See steps to reproduce

@iamandrewluca
Copy link
Contributor

We are aware of this warning, it comes from react-transition-group library.
react-transition-group released a new minor version with a new API that overcomes that warning. We need to release a new major version and to adapt everywhere we use react-transition-group.

@samuelcolvin
Copy link

Unless I'm confused, this is still an issue and I don't see a link to a duplicate issue.

I therefore don't think this should have been closed?

@samuelcolvin
Copy link

I guess #1340 is the tracking issue for this type of problem.

@iamandrewluca
Copy link
Contributor

Yes, we need to update react-transition-group and all warnings should disappear

@SleepyCatzzz
Copy link

Is there any update on this? I am beginning to build out, and the fact that this annoying issue has been going on over a year is troublesome enough I am tempted to use react-bootstrap because the error takes up so much space in my console.

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

No branches or pull requests

4 participants