Questions tagged [react-16]
92 questions
127
votes
12 answers
Warning: Received `false` for a non-boolean attribute. How do I pass a boolean for a custom boolean attribute?
Warning: Received `false` for a non-boolean attribute `comingsoon`.
If you want to write it to the DOM, pass a string instead:
comingsoon="false" or comingsoon={value.toString()}.
How do I pass a boolean in a custom attribute for React?
I'm…

desilijic
- 1,405
- 2
- 9
- 5
44
votes
1 answer
Fragments giving Unexpected token error in React 16.2
I have the following component that renders a series of components. However, I downloaded React 16.2 and tried to use fragments instead of divs, but I get the following error:
Error in ./src/containers/answers.js
Syntax error: Unexpected token…

Dog
- 2,726
- 7
- 29
- 66
20
votes
3 answers
React Router with React 16.6 Suspense "Invalid prop `component` of type `object` supplied to `Route`, expected `function`."
I'm using the latest version (16.6) of React with react-router (4.3.1) and trying to use code splitting using React.Suspense.
Although my routing is working and the code did split into several bundles loaded dynamically, I'm getting a warning about…

ronnyrr
- 1,481
- 3
- 26
- 45
13
votes
3 answers
React preloading components with Lazy + Suspense
I'm currently using React 16 with Suspense and Lazy to code-split my codebase. Although I would like to preload components.
In my example below I got two routes. Is there a way to preload Demo as soon Prime did mount? I've tried to create another…

ronnyrr
- 1,481
- 3
- 26
- 45
13
votes
2 answers
getDerivedStateFromProps is not called
I use React 16.3.1 and next.js.
And I put getDerivedStateFromProps inside the class extending PureComponent.
Here is the code:
Header.js
import { PureComponent } from 'react'
...
export default class Header extends PureComponent {
constructor…

Rizki Sunaryo
- 468
- 1
- 5
- 14
11
votes
1 answer
Uncaught TypeError: Cannot read property 'injection' of undefined
I am getting following error after upgrading react to 16.x
Uncaught TypeError: Cannot read property 'injection' of undefined
at injectTapEventPlugin (injectTapEventPlugin.js:23)
at eval (index.js:53)
at Object.…

Dark Knight
- 995
- 4
- 22
- 48
10
votes
3 answers
React: reading data passed as parameter in history.push
I am new to react and I am trying to send some data as parameter in history.push.
Basically I am calling a method on a button click and inside the method I am calling an api. If I get success response I redirect to other page and I need to pass some…

Molly
- 1,887
- 3
- 17
- 34
8
votes
1 answer
React 16.4 enables getDerivedStateFromProps to be called from state change. How to cope with that?
So 16.4 "fixes" a bug in getDerivedStateFromProps and now it gets fired both on props change and on state change. Obviously this is intended, coming from this post: https://github.com/facebook/react/issues/12898. However for me, saving previous…

Chris Panayotova
- 723
- 1
- 8
- 17
7
votes
1 answer
Where to call Sentry.configureScope?
I am using sentry browser with my CRA react application.
I create an error-boundary component and I am using it to catch errors.
So far so good, I catch the error and successfully log it to sentry.
The problem comes when I want to pass user…

gianni
- 1,199
- 2
- 14
- 28
6
votes
1 answer
SSR: dynamic import in react app how to deal with html miss match when component is loading on the client
I'm just starting on server side rendering a react 16 app using code splitting and dynamic import thanks to webpack 4 and react-loadable.
My question might sound stupid but there's something I don't quite get.
On the server side, I'm waiting that…

jaybe78
- 363
- 4
- 18
6
votes
1 answer
Map over Fragment in React 16
I am trying to map over the children of a fragment that is in turn a child of a component. For example:
const Frag = () => (
);
const Outer = ({…
test1
test2

Alex Bieg
- 355
- 2
- 15
5
votes
2 answers
Material UI 0.2x compatibility with React 16
After trying to upgrade from React 15.4 to React 16.4.1 (also upgraded react-dom to 16.4.1) I'm getting this error message from the router:
TypeError: _nextProps.children is not a function
at ReactDOMServerRenderer.render…

rfc1484
- 9,441
- 16
- 72
- 123
5
votes
1 answer
PureComponent decorated by mobx-react throws error about `shouldComponentUpdate` presence
In console I see this warning:
index.js:2178 Warning: Body has a method called
shouldComponentUpdate(). shouldComponentUpdate should not be used when
extending React.PureComponent. Please extend React.Component if
shouldComponentUpdate is…

zmii
- 4,123
- 3
- 40
- 64
5
votes
2 answers
React 16.3.* context Provider Err: Expected string or class/func but got: Object
Edit: Answer Below
I've followed both of these tutorials on youtube (currently there aren't too many) but none of them work for me, it sends me this error from the Provider in the index.js:
Tutorial 1: video and code
Tutorial 2: video and…

Kevin Danikowski
- 4,620
- 6
- 41
- 75
4
votes
0 answers
Error handling with react SSR renderToNodeStream
I am trying to figure out how to properly error handle with react streams. Let say there is an error inside . What is the best way to catch the error? The catch block don't seem to be catching the error as it doesn't console.log anything when…

PBandJ
- 2,537
- 3
- 21
- 31