Commit 865f123e authored by wildfirecode's avatar wildfirecode

1

parent 65ca0883
@import '~antd/dist/antd.css';
.App { .App {
text-align: center; text-align: center;
} }
......
import React from 'react'; import React from 'react';
import logo from './logo.svg'; import { Button } from 'antd';
import './App.css'; import './App.css';
function App() { const handleClick = async () => {
const a = 1+2; const response = await fetch('/api/todos');
console.log(a) const json = await response.json();
return ( console.log(json.data);
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload....
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React5
</a>
</header>
</div>
);
} }
const App = () => (
<div className="App">
<Button type="primary" onClick={handleClick}>Click Me!</Button>
</div>
);
export default App; export default App;
import React from 'react'; import React from 'react';
function Footer() { function Footer() {
const handleClick = async () => {
const response = await fetch('/api/todos');
const json = await response.json();
console.log(json.data);
}
return ( return (
<div> <div>
<button onClick={handleClick}>clickme!</button> nothing here...
</div> </div>
); );
......
...@@ -7,8 +7,8 @@ import * as serviceWorker from './serviceWorker'; ...@@ -7,8 +7,8 @@ import * as serviceWorker from './serviceWorker';
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <React.StrictMode>
<Footer />
<App /> <App />
<Footer />
</React.StrictMode>, </React.StrictMode>,
document.getElementById('root') document.getElementById('root')
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment