As far as I can tell from looking, codecademy, w3schools,
and many answers on stack overflow are all outdated.
The best option is "https://reactjs.org/"
# React: Setup, Create, and Run :)
1. npm install npx
2. npx create-react-app app-name
3. cd app-name
4. npm start
npx create-react-app my-app
cd my-app
cd src
# If you're using a Mac or Linux:
rm -f *
# Or, if you're on Windows:
del *
# Then, switch back to the project folder
cd ..
class Board extends React.Component {
constructor(props) { super(props); this.state = { squares: Array(9).fill(null), }; }
renderSquare(i) {
return <Square value={i} />;
}
renderSquare(i) {
return <Square value={i} />;
}
// src/App.js
import "./styles.css";
export default function App() {
const todos = [
{ id: 1, text: "Wash dishes", done: false },
{ id: 2, text: "Do laundry", done: false },
{ id: 3, text: "Take shower", done: false }
];
return (
<div>
<h1>Todo List</h1>
<TodoList todos={todos} />
</div>
);
}
function TodoList(props) {
console.log(props) // {todos: Array(3)}
}
return React.createElement('div', {className: 'shopping-list'},
React.createElement('h1', /* ... h1 children ... */),
React.createElement('ul', /* ... ul children ... */)
);
class Square extends React.Component {
render() {
return (
<button className="square" onClick={() => console.log('click')}>
{this.props.value}
</button>
);
}
}
class Square extends React.Component {
render() {
return (
<button className="square" onClick={() => console.log('click')}>
{this.props.value}
</button>
);
}
}