Clean Up React Code with useReducer | Code Renovation

  Рет қаралды 3,500

Syntax

Syntax

Күн бұрын

Пікірлер: 18
@Stoney_Eagle
@Stoney_Eagle 2 күн бұрын
Sometimes extra boilerplate code "reduces" complexity and makes things more managible. Man these CJ videos are a freaking goldmine for new developers, I wish I had these when I started! (I do miss your shenanigan live streams CJ) 😊
@madmaxdev
@madmaxdev 2 күн бұрын
Sometimes, I find it challenging to work with TypeScript, particularly when it comes to defining and integrating types in a way that flows seamlessly within the code. I watched your Hono Starter API video, where you wrote TypeScript effortlessly and seamlessly. Could you please create a video explaining how to work with TypeScript effectively, focusing on proper practices for defining and integrating types?
@StingSting844
@StingSting844 2 күн бұрын
Yeah I need this too. But I'm afraid we'll get the knowledge only by building lots of small things and gaining through pain. Every OSS project starts with rudimentary types and then someone comes along and makes it super well typed!
@thedelanyo
@thedelanyo 3 күн бұрын
I'm primarily a Svelte developer but I'm learning a good stuffs watching you write ReactJs 😅😅😅
@daveisdead
@daveisdead 3 күн бұрын
CJ always comes in with the bangers
@St0rMsk
@St0rMsk Күн бұрын
Someone call 🚒 CJ is on 🔥
@marwen_dev
@marwen_dev 3 күн бұрын
Thanks CJ, great insights 🎉! Waiting for your take on tanstack start.
@AlbertoVasquez1
@AlbertoVasquez1 2 күн бұрын
Thank you very much for the amazing example!
@MrCloudTel
@MrCloudTel 3 күн бұрын
This is awesome
@DarrylHebbes
@DarrylHebbes 12 сағат бұрын
This is more about types and less about reducers and why they differ from regular state
@DontFollowZim
@DontFollowZim 2 күн бұрын
Yup, still hate this pattern. Why would we prefer to put all these actions into a single function and call them using a string name rather than creating a function for each action so we don't rely on magic strings and switch statements? I also hate the { ...state, ...payload} pattern that functional programming and immutability force on you. I'm so much happier with Vue's reactive state.
@syntaxfm
@syntaxfm 2 күн бұрын
This pattern is definitely not for everyone. One of the main benefits is consolidation / colocation of logic. The action types as plain strings only makes the most sense when working with TypeScript. The custom action types I created enforce the combination of a type and payload (you cannot mix and match or you will get a type error).
@BekhzodIsmoiliy
@BekhzodIsmoiliy Күн бұрын
@@syntaxfmbut you can use the same type protection for your function params using “pick” utility type. So I either cannot understand the benefit of using additional string property. Why use so many extra code with types string properties switch cases extra if statements, when you can recreate it using functions for each of your actions. And you can still manage to have pure functions if you wish
@ayatullah8748
@ayatullah8748 3 күн бұрын
I recently reduced 5-6 useState with a single reducer. just props drilling the state and dispatch. Without props drilling what else i can use any suggestions??
@syntaxfm
@syntaxfm 3 күн бұрын
The Context API would allow you to put the reducer state / dispatch into context, and then bring it into any component with useContext and no prop drilling.
@lnard0
@lnard0 3 күн бұрын
code for the finished reducer pls
@oWeRQ666
@oWeRQ666 Күн бұрын
I don't understand, why not just use one state, and instead of action creator make functions that accept and return a state, compatible with setState.
Manage State in JavaScript Like a Pro!
1:02:00
Syntax
Рет қаралды 6 М.
What's New in .NET 9 with Examples
25:02
Nick Chapsas
Рет қаралды 47 М.
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 4,7 МЛН
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 4,5 МЛН
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 53 МЛН
Why Everyone Loves Zustand
29:27
Theo - t3․gg
Рет қаралды 107 М.
The BEST No-Nonsense VSCode Setup for Python Devs
26:05
ArjanCodes
Рет қаралды 25 М.
Senior Devs Use These React Hooks
7:05
Youssef Benlemlih
Рет қаралды 3,2 М.
Microsoft Ignite 2024: Everything Revealed in 15 Minutes
15:03
docker stack is my new favorite way to deploy to a VPS
27:47
Dreams of Code
Рет қаралды 66 М.
The Future of VS Code and Copilot
42:12
Syntax
Рет қаралды 2,7 М.
Clean Architecture with ASP.NET Core 9
27:01
dotnet
Рет қаралды 24 М.
DTOs & Mapping : The Good, The Bad, And The Excessive
11:03
CodeOpinion
Рет қаралды 13 М.
Deno 2 Deep Dive | Exploring the Deno Ecosystem
1:01:05
Syntax
Рет қаралды 8 М.
15 POWERFUL Python Libraries You Should Be Using
22:31
ArjanCodes
Рет қаралды 58 М.
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 4,7 МЛН