better api template & css modules example
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
import React from 'react';
|
||||
import HelloWorld from './components/HelloWorld';
|
||||
import './style/style.css';
|
||||
import './style/style.css'; // regular CSS -> className='app'
|
||||
import styles from './style/App.module.css'; // module CSS -> className={styles.App} (AKA styled components)
|
||||
// import * as api from './api';
|
||||
// un-comment this ^ ^ ^ to import api endpoints
|
||||
// ^ ^ ^ un-comment this to import api endpoints
|
||||
|
||||
function App() {
|
||||
// const [data, setData] = React.useState([]);
|
||||
// React.useEffect(() => {
|
||||
// api
|
||||
// .getSomething() // replace this with your endpoint
|
||||
// .then((response) => console.log(`✅ ${response.status} ${response.statusText}`, response.data))
|
||||
// .then((response) => console.log(`✅ ${response.status} ${response.statusText}`, setData(response.data)))
|
||||
// .catch((error) => console.log(`❌ ${error}`));
|
||||
// });
|
||||
// }, []);
|
||||
//
|
||||
// example ^ ^ ^ using the api endpoint
|
||||
// ^ ^ ^ example using the api endpoint
|
||||
|
||||
return (
|
||||
<div className='App'>
|
||||
<div className={styles.App}>
|
||||
<HelloWorld />
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user