File tree Expand file tree Collapse file tree 4 files changed +53
-45
lines changed Expand file tree Collapse file tree 4 files changed +53
-45
lines changed Original file line number Diff line number Diff line change 1
- .App {
2
- text-align : center;
3
- }
4
1
5
- .App-logo {
6
- animation : App-logo-spin infinite 20s linear;
7
- height : 80px ;
8
- }
9
-
10
- .App-header {
11
- background-color : # 222 ;
12
- height : 150px ;
13
- padding : 20px ;
14
- color : white;
15
- }
16
-
17
- .App-title {
18
- font-size : 1.5em ;
19
- }
20
-
21
- .App-intro {
22
- font-size : large;
23
- }
24
-
25
- @keyframes App-logo-spin {
26
- from { transform : rotate (0deg ); }
27
- to { transform : rotate (360deg ); }
28
- }
Original file line number Diff line number Diff line change 1
- import React , { Component } from 'react' ;
2
- import logo from './logo.svg' ;
1
+ import React from 'react' ;
3
2
import './App.css' ;
3
+ import HelloWorld from './HelloWorld' ;
4
4
5
- class App extends Component {
6
- render ( ) {
7
- return (
8
- < div className = "App" >
9
- < header className = "App-header" >
10
- < img src = { logo } className = "App-logo" alt = "logo" />
11
- < h1 className = "App-title" > Welcome to React</ h1 >
12
- </ header >
13
- < p className = "App-intro" >
14
- To get started, edit < code > src/App.js</ code > and save to reload.
15
- </ p >
16
- </ div >
17
- ) ;
18
- }
19
- }
5
+ const App = ( ) => {
6
+ return (
7
+ < div className = "App" >
8
+ < HelloWorld name = "World" />
9
+ < HelloWorld name = "React" />
10
+ </ div >
11
+ ) ;
12
+ } ;
20
13
21
- export default App ;
14
+ export default App ;
Original file line number Diff line number Diff line change
1
+ .HelloWorld {
2
+ border : 6px solid black;
3
+ text-align : center;
4
+ background : # c7e3f7 ;
5
+ color : # 333 ;
6
+ margin : 20px ;
7
+ padding : 20px ;
8
+ }
Original file line number Diff line number Diff line change
1
+ import React , { Component } from 'react' ;
2
+ import './HelloWorld.css' ;
3
+
4
+
5
+ class HelloWorld extends Component {
6
+ constructor ( props ) {
7
+ super ( props ) ;
8
+ this . state = { greeting : 'Hello' } ;
9
+ this . spanishify = this . spanishify . bind ( this ) ;
10
+ this . lebanify = this . lebanify . bind ( this ) ;
11
+ }
12
+ spanishify ( ) {
13
+ this . setState ( { greeting : 'Hola' } ) ;
14
+ }
15
+ lebanify ( ) {
16
+ this . setState ( { greeting : 'Hi, keefak, sa va' } ) ;
17
+ }
18
+ render ( ) {
19
+ return (
20
+ < div className = "HelloWorld" >
21
+ { this . state . greeting } { this . props . name } !
22
+ < br />
23
+ < button onClick = { this . spanishify } > Spanishify!</ button >
24
+ < button onClick = { this . lebanify } > Lebanify!</ button >
25
+ </ div >
26
+ ) ;
27
+ }
28
+ }
29
+
30
+ /* const HelloWorld = props => {
31
+ return (<div className="HelloWorld">Hello {props.name}!</div>);
32
+ }; */
33
+
34
+ export default HelloWorld ;
You can’t perform that action at this time.
0 commit comments