File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Practice/Express-React/frontend/src Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ class Clickable extends React . Component {
4+
5+ constructor ( props ) {
6+ super ( props ) ;
7+ this . handleClick = this . handleClick . bind ( this ) ;
8+ }
9+
10+ handleClick ( event ) {
11+ console . log ( event ) ;
12+ console . log ( "I was clicked" ) ;
13+ }
14+
15+ render ( ) {
16+ return (
17+ < button onClick = { this . handleClick } > { this . props . displayText } </ button >
18+ ) ;
19+ }
20+ }
21+
22+ export default Clickable ;
Original file line number Diff line number Diff line change @@ -2,13 +2,15 @@ import React from 'react';
22import ReactDOM from 'react-dom/client' ;
33import './index.css' ;
44import App from './App' ;
5+ import Clickable from './components/Clickable' ;
56import reportWebVitals from './reportWebVitals' ;
67import FileContent from './components/FileContent' ;
78
89const root = ReactDOM . createRoot ( document . getElementById ( 'root' ) ) ;
910root . render (
1011 < div >
1112 < FileContent />
13+ < Clickable displayText = "Clickable Button" />
1214 </ div >
1315) ;
1416
You can’t perform that action at this time.
0 commit comments