Created
December 27, 2018 11:21
-
-
Save darksh3ll/3f9a3cd1d2076b18996d97ca6045f24c to your computer and use it in GitHub Desktop.
change classeName react
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, {Component} from 'react'; | |
| import { Button } from 'reactstrap'; | |
| import {Link} from "react-router-dom" | |
| import "./Home.css" | |
| class Home extends Component { | |
| state = { | |
| todos:[], | |
| on:false | |
| }; | |
| changeColor = () => { | |
| this.setState({on:!this.state.on}) | |
| } | |
| render() { | |
| return ( | |
| <div className={this.state.on? "red":"home"}> | |
| <h1>Todo List</h1> | |
| <Link to="/1"> | |
| <Button color="light size="sm>Commencer</Button>{' '} | |
| </Link> | |
| <Button | |
| onClick={this.changeColor} | |
| color="light"> | |
| click</Button> | |
| {' '} | |
| </div> | |
| ); | |
| } | |
| } | |
| export default Home; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment