learn-reactjs-2023-context-api/README.md

108 lines
3.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Self-learning Project for ReactJS - Context API (2023)
This is a self-learning project for ReactJS - Context API in 2023
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
# Key information
## NPM or Yarn?
This project use `yarn`
## minicss and mui
In this project, two styling frameworks have beeen added:
### mini.css
See: https://www.npmjs.com/package/mini.css
Note: there are similar project called: mini-css and minicss
`yarn add mini.css`
### Material UI (MUI)
See: https://mui.com/material-ui/getting-started/installation/
`yarn add @mui/material @emotion/react @emotion/styled @mui/icons-material`
### Use React Router DOM
Install with typescript:
`yarn add react-router-dom`
`yarn add --dev @types/react-router-dom`
for typescript
--save-dev typescript @types/node @types/react @types/react-dom @types/jest @types/react-router-dom
## Before you start
After cloning this project to your local environment, run install:
`yarn install`
## Available Scripts you need to know
- `yarn start`
- `yarn test`
- `yarn run build`
- `yarn run eject`
Note: See below section of the explaination
# Study Notes
## Online References
- https://stackoverflow.com/questions/38187833/how-to-combine-reactjs-router-link-and-material-ui-components-like-a-button
- https://reactrouter.com/en/main/components/link
- https://www.freecodecamp.org/news/how-to-use-react-router-version-6/
- https://devtrium.com/posts/how-use-react-context-pro
- https://www.developerway.com/posts/react-re-renders-guide
- https://mui.com/material-ui/customization/breakpoints/
- https://reactjs.org/docs/conditional-rendering.html
- https://ithelp.ithome.com.tw/articles/10224270
- https://www.geeksforgeeks.org/reactjs-functional-components/
---
## Available Scripts - Explain
In the project directory, you can run:
### `yarn start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `yarn test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `yarn run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `yarn run eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.