react-navi causing error in StrictMode
See original GitHub issueSideEffect
is causing an error in StrictMode
.
SideEffect.prototype.componentWillMount = function componentWillMount() {
mountedInstances.push(this);
emitChange();
};
found this in react-navi/dist/umd/react-navi.js
. Using StrictMode
it causes this error:
Warning: Unsafe lifecycle methods were found within a strict-mode tree:
in StrictMode (at App.tsx:7)
in App (at src/index.tsx:6)
componentWillMount: Please update the following components to use componentDidMount instead: SideEffect(NullComponent)
Learn more about this warning here:
https://fb.me/react-strict-mode-warnings
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Why there is there an error when using React strict mode?
Doing some experimenting, I found that the issue is with the import. import {React, useState} from 'react'; does not import React causing it...
Read more >please update the following components: sideeffect(nullcomponent2 ...
found this in react-navi/dist/umd/react-navi.js . Using StrictMode it causes this error: Warning: Unsafe lifecycle methods were found within a strict-mode ...
Read more >Strict Mode - React
StrictMode is a tool for highlighting potential problems in an application. Like Fragment , StrictMode does not render any visible UI.
Read more >strict mode and non strict mode in javascript medium Code Example
'use strict'; //Strict mode makes some bad practices return errors. //Some programmers use this to help them avoid bad habits.
Read more >What is StrictMode in React? - KnowledgeHut
For its descendant components, it activates additional deprecation checks and warnings. The fact that it gives visual feedback (warning/error ...
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
I think I’m leaning that way too, although you’re right that it’d be a breaking change.
The next release should provide a way to add custom matchers like
withHead
andwithTitle
, so perhaps what I’ll do is extract withHead/withTitle to a separate package in the next release, and switch that package to use react-helmet-async at the same time.In the meantime, if react-helmet-async is API compatible with react-helmet, I would accept a PR to switch over in a minor release to help with
<StrictMode>
.This looks to be caused by the dependency on react-helmet. I’m going to need to update Navi to either use react-helmet-async, or just remove react-helmet and leave head/title management to the application.
Would love to hear any thoughts on the best option here.