Zustand and Immer - Level Up Code Blog

Zustand and Immer - Level Up Code Blog

Ben Awad mentioned this too. I just did this like a month ago on this project at work (but with easy-peasy + lodash.set). It's a really cool pattern to be able to do `setGlobalState('someKey', 'someVal')` and `const { someKey } =...

Ben Awad mentioned this too. I just did this like a month ago on this project at work (but with easy-peasy + lodash.set). It's a really cool pattern to be able to do setGlobalState('someKey', 'someVal') and const { someKey } = useGlobalState(). Not sure what I like for component state exactly. easy-peasy has something for it, but tbh I just use useState for ephemeral component state. It might make sense to put all UI in globalState (because then you can persist it super easy), and then you could argue the only state a component needs is form state, so just use react-hook-form for ephemeral component state.

So, long story short, a really slick setup might be:

  1. create setGlobalState and useGlobalState helper hooks in easy-peasy (easy-peasy gives you Redux DevTools for free)
  2. put all UI in global state
  3. use react-hook-form for all component state

Dunno... might not work. Probably don't want to have unused state (like a huge list of users) lying around if a component is unmounted... There might be a way to do something where you could pass a 3rd argument to setGlobalState that discards the state when the component isn't mounted.

code visual studio code visual studio

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

COMO USAR e trabalhar com Code Review no Visual Studio Code

💲 Live CollabPlay: https://youtu.be/B6LCFSPdsE0 💲 Hospedagem com Desconto Exclusivo: https://tekers.tech/4e587 Não é todo programador que gosta de compartilh...

User Snippets (Code Shortcuts) in Visual Studio Code

#vscode Hello, my friends and fellow developers, this video is all about User Snippets. That means the Snippets (Code Shortcuts) that you can make for yourse...

Python в Visual Studio Code

We are pleased to announce that the July release of the Python extension is now available for Visual Studio Code. You can download the Python extension from the Marketplace, or install it directly from the extension gallery in Visual Studio Code. If you already have the Python extension installed, you can also get the latest update by restarting Visual Studio Code. You can read more about Python support in Visual Studio Code in the documentation .

C++ Development with Visual Studio Code

If you’re looking for a fast and lightweight open-source code editor, Visual Studio Code has you covered. Come for a deep dive into the features of Visual Studio Code which provide a rich, productive environment for C++ development.

The History of Visual Studio Code

We speak to the creator of Visual Studio Code about the early challenges to now becoming the most popular development environment in the world.