File tree Expand file tree Collapse file tree 6 files changed +35
-31
lines changed Expand file tree Collapse file tree 6 files changed +35
-31
lines changed Original file line number Diff line number Diff line change 1717 },
1818 "scripts" : {
1919 "start" : " react-scripts start" ,
20+ "prebuild" : " npm run setup && npm run test -- --watchAll=false" ,
2021 "build" : " react-scripts build" ,
2122 "test" : " react-scripts test" ,
22- "eject" : " react-scripts eject"
23+ "eject" : " react-scripts eject" ,
24+ "setup" : " npm uninstall react-classnaming --no-audit --progress=false --quiet --silent && npm install ../.. --no-audit --progress=false --quiet --silent"
2325 },
2426 "eslintConfig" : {
2527 "extends" : [
Original file line number Diff line number Diff line change @@ -3,5 +3,5 @@ import App from './App';
33import renderer from 'react-test-renderer' ;
44
55test ( 'snapshot' , ( ) => {
6- expect ( renderer . create ( < App /> ) . toJSON ( ) ) . toMatchSnapshot ( )
6+ expect ( renderer . create ( < App className = "App" /> ) . toJSON ( ) ) . toMatchSnapshot ( )
77} ) ;
Original file line number Diff line number Diff line change 1- import React from 'react' ;
1+ import React , { PropsWithChildren } from 'react' ;
22import logo from './logo.svg' ;
3- import './App.css' ;
43
5- function App ( ) {
4+ function App ( { className } : { className : string } ) {
65 return (
7- < div className = "App" >
8- < header className = "App-header" >
9- < img src = { logo } className = "App-logo" alt = "logo" />
6+ < div className = { className } >
7+ < Header className = "App-header" >
8+ < Logo className = "App-logo" />
109 < p >
1110 Edit < code > src/App.tsx</ code > and save to reload.
1211 </ p >
13- < a
14- className = "App-link"
15- href = "https://reactjs.org"
16- target = "_blank"
17- rel = "noopener noreferrer"
18- >
19- Learn React
20- </ a >
21- </ header >
12+ < Link className = "App-link" />
13+ </ Header >
2214 </ div >
2315 ) ;
2416}
2517
2618export default App ;
19+
20+ function Header ( { className, children} : PropsWithChildren < { className : string } > ) {
21+ return < header className = { className } > { children } </ header >
22+ }
23+
24+ function Logo ( { className} : { className : string } ) {
25+ return < img src = { logo } className = { className } alt = "logo" />
26+ }
27+
28+ function Link ( { className} : { className : string } ) {
29+ return < a
30+ className = { className }
31+ href = "https://reactjs.org"
32+ target = "_blank"
33+ rel = "noopener noreferrer"
34+ >
35+ Learn React
36+ </ a >
37+ }
Original file line number Diff line number Diff line change @@ -3,10 +3,11 @@ import ReactDOM from 'react-dom';
33import './index.css' ;
44import App from './App' ;
55import reportWebVitals from './reportWebVitals' ;
6+ import './App.css' ;
67
78ReactDOM . render (
89 < React . StrictMode >
9- < App />
10+ < App className = "App" />
1011 </ React . StrictMode > ,
1112 document . getElementById ( 'root' )
1213) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 33 "version" : " 1.0.0" ,
44 "description" : " " ,
55 "scripts" : {
6- "test" : " cd cra && npm run test"
6+ "test" : " npm run cra && npm run create-react-app" ,
7+ "cra" : " cd cra && npm run build" ,
8+ "create-react-app" : " cd create-react-app && npm run build"
79 },
810 "keywords" : [],
911 "author" : " " ,
You can’t perform that action at this time.
0 commit comments