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.

react-navi causing error in StrictMode

See original GitHub issue

SideEffect 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:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
jamesknelsoncommented, Mar 28, 2019

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 and withTitle, 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>.

2reactions
jamesknelsoncommented, Mar 27, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

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