Рет қаралды 17,594
Web Dev Roadmap for Beginners (Free!): bit.ly/DaveGrayWebDevRoadmap
Learn useReducer with Typescript + React Hooks in this React + TS tutorial. useReducer is a replacement for the useState React hook, and is often used with more complex state. Learn how to provide types for a reducer function, actions, and more.
🚀 Become a full-stack web dev with Zero To Mastery Courses:
- The Complete Web Developer: bit.ly/WebDevMaster
- Master the Coding Interview: bit.ly/FAANGInterview
- Junior to Senior Dev Roadmap: bit.ly/WebDevRoadmap-JrtoSr
🚩 Subscribe ➜ bit.ly/3nGHmNn
📬 Course Updates ➜ courses.davegray.codes/
❓ Questions - Please post them to my Discord ➜ / discord
☕ Buy Me A Coffee ➜ www.buymeacoffee.com/davegray
👇 Follow Me On Social Media:
Github: github.com/gitdagray
Twitter: / yesdavidgray
LinkedIn: / davidagray
🔗 All Resources for this Typescript Course: github.com/gitdagray/typescri...
🔗 Playlist for this Typescript Course: bit.ly/3GcNJ78
Learn useReducer with Typescript + React
(00:00) Intro
(00:08) Welcome
(00:30) Starter Code Review
(02:45) What is useReducer?
(03:30) Define initial state
(03:51) Reducer Action Type: enum or object?
(04:58) type ReducerAction
(05:37) reducer function
(08:38) Refactoring from useState to useReducer
(11:18) Adding a Payload
📚 Suggested Pre-requisites for this Typescript course:
🔗JavaScript for Beginners full course: • JavaScript Full Course...
📚 React Hooks tutorials:
🔗 useState: • Avoid this React State...
🔗 useEffect: • React useEffect Hook t...
🔗 useCallback: • useCallback STOPS this...
🔗 useMemo: • useMemo Explained | Re...
🔗 useRef: • BUILD a React Timer wi...
🔗 useReducer: • useReducer is BETTER t...
📚 Tutorial References:
🔗 TypeScript + React Cheatsheet: github.com/typescript-cheatsh...
🔗 React Official Website: reactjs.org/
🔗 Typescript Official Website: www.typescriptlang.org/
🔗 Anders Hejlsberg, Creator of Typescript and C# Interview: dev.to/destrodevshow/typescri...
🔗 Stackoverflow Survey Results: survey.stackoverflow.co/2022/...
🔗 MDN - Static Typing: developer.mozilla.org/en-US/d...
🔗 MDN - Dynamic Typing: developer.mozilla.org/en-US/d...
🔗 MDN - Type Coercion: developer.mozilla.org/en-US/d...
🔗 TS Type Assertions: www.typescriptlang.org/docs/h...
⚙ Web Dev Tools:
🔗 Vite: vitejs.dev/
🔗 Chrome Browser: www.google.com/chrome/
🔗 Visual Studio Code (VS Code): code.visualstudio.com/
🔗 Node.js & npm: nodejs.org/
🔗 Live Server VS Code Extension: marketplace.visualstudio.com/...
Was this React Hooks + Typescript useReducer tutorial helpful? If so, please share. Let me know your thoughts in the comments.
#usereducer #react #typescript