Guest User

Untitled

a guest
Sep 11th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class XD extends React.Component {
  2.    
  3.     state = {
  4.         showInput: false
  5.     };
  6.    
  7.     render() {
  8.         const {showInput} = this.state;
  9.         return (
  10.             <div>
  11.                 <p>xD</p>
  12.                 <div>
  13.                     <input type="checkbox" id="scales" name="scales"
  14.                         checked={showInput} onClick={() => this.setState(prev =>({showInput: !prev.showInput}))}/>
  15.                     <label htmlFor="scales">Scales</label>
  16.                 </div>
  17.                 {showInput &&
  18.                     <div>
  19.                         <input type="text" id="horns" name="horns"/>
  20.                         <label htmlFor="horns">Horns</label>
  21.                     </div>
  22.                 }
  23.             </div>
  24.         );
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment