https://github.com/natserract/react-ts-cheatsheet
Cheatsheets for experienced React developers getting started with TypeScript
https://github.com/natserract/react-ts-cheatsheet
cheatsheets developers javascript react typescript
Last synced: 6 months ago
JSON representation
Cheatsheets for experienced React developers getting started with TypeScript
- Host: GitHub
- URL: https://github.com/natserract/react-ts-cheatsheet
- Owner: natserract
- Created: 2019-12-14T02:33:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T02:58:47.000Z (almost 3 years ago)
- Last Synced: 2025-02-09T18:44:03.030Z (8 months ago)
- Topics: cheatsheets, developers, javascript, react, typescript
- Language: TypeScript
- Homepage:
- Size: 3.98 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React-Typescript-Cheatsheet ♥️
This is the cheasheet I made for myself. Sorry if the code is dirty. You can browse for files in the `src/component/` directory to see examples.## Quick Example
```tsx
//Action - Hooks UseReducer Section
type Action = { type: 'INCREMENT' } | { type: 'DECREMENT' } | { type: 'RESET' }//Initial Reducer - Hooks UseReducer Section
const reducer = (state: State, action: Action) => {
switch (action.type) {
case 'INCREMENT': {
return {
...state,
count: state.count + 1
}
}
case 'DECREMENT': {
return {
...state,
count: state.count - 1
}
}
case 'RESET': {
return {
...state,
count: 0,
}
}
default: throw new Error()
}
}```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.