TypeScript and React sometimes need a helping hand so they can play ball well together. Getting proper type-safety when dealing with the Context API is rather tricky with some quite nasty pitfalls that can be time-consuming. In this video I'll show you how to achieve what you need to get the compiler happy and satisfied! ⚡️
💯 type-safety
no hacks 🔥
📽 Chapters
0:09 What is the Context API? 🧐
2:45 Starting with some CSS 🎨
6:05 Creating components 🏗
7:35 Add new components to App.tsx 📦
8:05 More CSS: index.css base styles 🖼
8:30 Create context.tsx 🧭
10:49 using Context with a Custom Hook for better Developer Experience 🪝
11:52 first types for our Context ⚙️
13:47 Add useContext on App.tsx ⚡️
14:18 Add Context.Provider to index.tsx 🖇
14:47 Passing Context provided props to different components 🎁
15:10 Strong-Type consumer components 🔒
15:54 Strong-Type React.createContext call 💥
16:33 Adding the click handlers! 🙈
Sur cette page du site, vous pouvez voir la vidéo en ligne Type useContext : React and TypeScript durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Atila 06 avril 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 15,888 fois et il a aimé 275 téléspectateurs. Bon visionnage!