moved css module example to component exmaple
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import HelloWorld from './components/HelloWorld';
|
import HelloWorld from './components/HelloWorld/HelloWorld';
|
||||||
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';
|
// import * as api from './api';
|
||||||
// ^ ^ ^ un-comment this to import api endpoints
|
// ^ ^ ^ un-comment this to import api endpoints
|
||||||
|
|
||||||
@@ -17,7 +15,7 @@ function App() {
|
|||||||
// ^ ^ ^ example using the api endpoint
|
// ^ ^ ^ example using the api endpoint
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.App}>
|
<div>
|
||||||
<HelloWorld />
|
<HelloWorld />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
|
|
||||||
function HelloWorld() {
|
|
||||||
return <div>Hello World - React.js</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default HelloWorld;
|
|
||||||
8
client/src/components/HelloWorld/HelloWorld.jsx
Normal file
8
client/src/components/HelloWorld/HelloWorld.jsx
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styles from './style/HelloWorld.module.css'; // CSS module -> className={styles.App} (AKA styled components)
|
||||||
|
|
||||||
|
function HelloWorld() {
|
||||||
|
return <div className={styles.HelloWorld}>Hello World - React.js</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HelloWorld;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
.App {
|
.HelloWorld {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: grid;
|
display: grid;
|
||||||
Reference in New Issue
Block a user