state = { showSomething: false } toogleSomething = () => { const holder = this.state.showSomething; this.setState({showSomething: !holder});
//Holder holds the previous value so that the next time you call the function it will be updated with the other new state value and therefore toggle. }
Wednesday, February 19, 2020
Javscript, React - Simple React Toggle Example
Monday, February 17, 2020
Create React App Instructions
install npm
create-react-app
npm install -g create-react-app
or with specific version
create-react-app assignment1 --scripts-version 1.1.5
cd myappname
npm start.
create-react-app
npm install -g create-react-app
or with specific version
create-react-app assignment1 --scripts-version 1.1.5
cd myappname
npm start.
Subscribe to:
Posts (Atom)