Please enable JavaScript.
Coggle requires JavaScript to display documents.
React V16 (Redux (What is redux? (https://redux.js.org/, Is a predictable…
React V16
-
-
Setup
-
-
Manual Setup
Installation
yarn
-
-
Webpack
-
-
-
create webpack.config.js
-
module.exports = { .. }
-
output: { .. }
path: path.join(__dirname, 'public')
- 2 more items...
-
-
-
-
JSX Support
loader
webpack.config.js
module: { .. }
- 1 more item...
-
-
babel-presets
- 2 more items...
-
-
-
Webpack Dev Server
-
webpack.config.js
devServer: { .. }
contentBase: path.join(__dirname, 'public)
-
-
-
-
-
-
-
-
Rendering
ReactDOM.render(<h1>Test</h1>, document.getElementById("root"))
-
-
-
-
Basic Concepts
Components
can return JSX
-
JSX (JavaScript XML)
looks like HTML, but its not
-
-
-
-
-
-
-
Component Types
Class Component
-
-
-
-
-
-
reference to functions within a class, do not call it with ()
Function Component
-
-
-
Rules
if a class component uses a render method only, use a functional component instead
allways start with a functional component. You can easily change it to a class component if neccessary
-
-
-
-
-
Third-Party Component
-
React-Router
-
app.js
import { BrowserRouter, Route, Switch, Link, NavLink } from 'react-router-dom';
-
-
-
-
Styling
Webpack necessary
supports
-
css
webpack.config.js
-
use: ['syle-loader', 'css-loader']
-
-
-
-
-
-
-
-
-
New Features
V16.8
State Hook
-
const [count, setCount] = useState(0);
-
-
-
-