Questions tagged [react-16]

88 questions
48
votes
8 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
  • 607
  • 1
  • 5
  • 5
32
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,120
  • 3
  • 18
  • 50
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,202
  • 2
  • 21
  • 40
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
  • 428
  • 1
  • 4
  • 14
11
votes
2 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,202
  • 2
  • 21
  • 40
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
  • 785
  • 2
  • 13
  • 35
9
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,819
  • 1
  • 15
  • 30
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
  • 591
  • 6
  • 13
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
  • 921
  • 11
  • 24
5
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…
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
  • 8,473
  • 15
  • 58
  • 111
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
  • 3,268
  • 2
  • 29
  • 53
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
  • 2,444
  • 1
  • 23
  • 42
4
votes
2 answers

What is the difference between a fibre object in React 16 and a React Element?

Here on this link (as a lotta people referring to, for understanding React 16's architecture) it is mentioned: Even Elements in React are plain JS objects that contains info about the component, having the following four props: { type, ref, …
UtkarshPramodGupta
  • 5,248
  • 4
  • 21
  • 44
4
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 = () => (
test1
test2
); const Outer = ({…
Alex Bieg
  • 325
  • 2
  • 15
1
2 3 4 5 6