Correct modification of state arrays in React.js

The React docs says: Treat this.state as if it were immutable. Your push will mutate the state directly and that could potentially lead to error prone code, even if you are “resetting” the state again afterwards. F.ex, it could lead to that some lifecycle methods like componentDidUpdate won’t trigger. The recommended approach in later React …

Read more

where is create-react-app webpack config and files?

If you want to find webpack files and configurations go to your package.json file and look for scripts You will find that scripts object is using a library react-scripts Now go to node_modules and look for react-scripts folder react-script-in-node-modules This react-scripts/scripts and react-scripts/config folder contains all the webpack configurations.

What does “export default” do in JSX?

Export like export default HelloWorld; and import, such as import React from ‘react’ are part of the ES6 modules system. A module is a self contained unit that can expose assets to other modules using export, and acquire assets from other modules using import. In your code: In ES6 there are two kinds of exports: Named exports – for example export function func() {} is a named …

Read more

React statics with ES6 classes

statics only works with React.createClass. Simply declare the method as a static class method: Regarding You are literally creating a statics property on the React object. That property does not magically extend your component.