Mostly a place to dump react things that I cant find a home for :D
Icons
1 | import { FaTimes } from 'react-icons/fa' |
Context or Store
When you find yourself passing state all the time as props.
When you dont really need a store. Yet.
RTK Query
“RTK Query is a powerful data fetching and caching tool. It is designed to simplify common cases for loading data in a web application, eliminating the need to hand-write data fetching & caching logic yourself.”
Dates
SPA Hello World
Some pointers
- 1 folder per component, css and test
- folders with Captial letter
Brian Holt: Complete Intro to React
1 | npm init |
Additional things I installed when adding typescript and changing to .tsx
files
1 | npm install react-date-picker |
React App
npx create-react-app
is the suggested method for creating new apps
1 | npx create-react-app my-app --template typescript |
1 | npm i react-icons #Icons |
1 | npm i redux react-redux @types/react-redux @types/redux redux-devtools-extension |
UI Material
1 | npm install @material-ui/core |
Extensions
ES7 React/Redux/GraphQL/React-Native snippets
1 | rafce |
- https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets
- https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
Tutorials
Learn.tsx and types
Here Props
belongs to Learn.tsx
and is destructured in the constructor.
1 | type Props = { |
Use as <Learn title={1} name="Hoe" />
interface
and type
are the same thing, interfaces merge themself so the example below will have name
and email
in the IStaff
interface where Staff
wont compile so I think using type
is safer.
1 | interface IStaff { |