1As far as I can tell from looking, codecademy, w3schools,
2and many answers on stack overflow are all outdated.
3
4The best option is "https://reactjs.org/"
1import React from 'react';
2
3class App extends React.Component {
4 constructor(props) {
5 super(props);
6
7 this.state = {
8 data: 'Initial data...'
9 }
10 this.updateState = this.updateState.bind(this);
11 };
12 updateState() {
13 this.setState({data: 'Data updated...'})
14 }
15 render() {
16 return (
17 <div>
18 <button onClick = {this.updateState}>CLICK</button>
19 <h4>{this.state.data}</h4>
20 </div>
21 );
22 }
23}
24export default App;
1class Board extends React.Component {
2 constructor(props) { super(props); this.state = { squares: Array(9).fill(null), }; }
3 renderSquare(i) {
4 return <Square value={i} />;
5 }
1npx create-react-app my-app
2cd my-app
3cd src
4
5# If you're using a Mac or Linux:
6rm -f *
7
8# Or, if you're on Windows:
9del *
10
11# Then, switch back to the project folder
12cd ..
1class Board extends React.Component {
2 constructor(props) {
3 super(props);
4 this.state = {
5 squares: Array(9).fill(null),
6 };
7 }
8 renderSquare(i) {
9 return <Square value={i} />;
10 }
11}