File tree Expand file tree Collapse file tree 1 file changed +11
-14
lines changed
Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Original file line number Diff line number Diff line change 1+ import React , { useState , useEffect } from 'react' ;
12import logo from './logo.svg' ;
23import './App.css' ;
34
45function App ( ) {
6+
7+ const [ currentGreetingV1 , setCurrentGreetingV1 ] = useState ( 'Unknown' ) ;
8+
9+ useEffect ( ( ) => {
10+ fetch ( '/api/greeting/v1/' ) . then ( res => res . json ( ) ) . then ( data => {
11+ setCurrentGreetingV1 ( data . message ) ;
12+ } )
13+ } )
14+
515 return (
616 < div className = "App" >
7- < header className = "App-header" >
8- < img src = { logo } className = "App-logo" alt = "logo" />
9- < p >
10- Edit < code > src/App.js</ code > and save to reload.
11- </ p >
12- < a
13- className = "App-link"
14- href = "https://reactjs.org"
15- target = "_blank"
16- rel = "noopener noreferrer"
17- >
18- Learn React
19- </ a >
20- </ header >
17+ < p > The current greeting is { currentGreetingV1 } </ p >
2118 </ div >
2219 ) ;
2320}
You can’t perform that action at this time.
0 commit comments