File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
1-exercise-solutions/lesson-04 Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 2424 function App ( ) {
2525 const [ isButtonOn , setIsButtonOn ] = React . useState ( true ) ;
2626
27- function switchButtonOn ( ) {
27+ function toggleButton ( ) {
2828 // Another solution is: setIsButtonOn(!isButtonOn);
2929 if ( isButtonOn ) {
3030 setIsButtonOn ( false ) ;
3636 return (
3737 < button
3838 className = "on-button"
39- onClick = { switchButtonOn }
39+ onClick = { toggleButton }
4040 >
4141 { isButtonOn ? 'ON' : 'OFF' }
4242 </ button >
Original file line number Diff line number Diff line change 3333 function App ( ) {
3434 const [ isButtonOn , setIsButtonOn ] = React . useState ( true ) ;
3535
36- function switchButtonOn ( ) {
36+ function toggleButton ( ) {
3737 if ( isButtonOn ) {
3838 setIsButtonOn ( false ) ;
3939 } else {
4848 return (
4949 < button
5050 className = { isButtonOn ? 'on-button' : 'off-button' }
51- onClick = { switchButtonOn }
51+ onClick = { toggleButton }
5252 >
5353 { isButtonOn ? 'ON' : 'OFF' }
5454 </ button >
You can’t perform that action at this time.
0 commit comments