mitt
hookstate
Our great sponsors
mitt | hookstate | |
---|---|---|
15 | 16 | |
10,213 | 1,625 | |
- | - | |
4.5 | 4.8 | |
4 months ago | 5 months ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
mitt
-
Event Bus with Vue 3 and TypeScript
Mitt is a small (200 bytes) library that provides the same functionality. It doesn't have many updates, because it's simply perfect and there are not many things to improve there. It gets the job done. Don't be frightened, if in 2 years npm will say it's 2 years old. This library is just perfect with no bloatware. In the worst case, just copy-paste its code to your app.
-
Explicit Design, Part 9. Decoupling Features with Events
The implementation can vary widely depending on the requirements. For our application, we will take a small library that will do almost everything for us:
-
Best way to pass data when dealing with deeply nested components?
You can use an event bus for this, looks like they removed this functionally from vue 3 so you'll need a 3rd party package like mitt
-
Using Event Bus in Vue.js 3
then we need to install an external library implementing the event emitter interface, in this case mitt
-
What is your must have npm package on any given project?
date-fns and mitt (event emitter) are also frequent helpers, but I'm considering dayjs and nanoevents for these cases.
-
Event emitter vs global variables
Not sure I understood the post right, bit you may want to check Mitt. It's popular event emitter package that quite nicely deals with this very issue.
-
Why and how to create an Event Bus in Vuejs 3
As suggested in official docs you could use mitt library to dispatch events across components.
-
Does vue 3 have global emit?
You can use it mitt library. https://github.com/developit/mitt
-
State Management Question
For situations like this, I use simple event emitter / pubsub library called mitt. It's small and lightweight, however there are many similar libraries that would work.
-
Event Bus Pattern in Nuxt 3 with full TypeScript support
In this article I want to show you how I have implemented this pattern in my Nuxt 3 applications using Mitt which already provides full TypeScript support. To fully understand what's happening under the hood I recommend to have a quick read of Mitt documentation before continue reading.
hookstate
-
A Comprehensive Guide to React State Management
Hookstate
-
ReactJS Good Practices
Avoid using complex state structures to make it easier to manage and debug. There are multiple libraries to help manage complex state management such as Redux, Hookstate, etc.
-
What is React State Management?
Link: https://hookstate.js.org/
- 2022: Best State management libraries in React JS
-
The new wave of React state management
As you stumble on this post and article, do check out one library not mentioned in this list: hookstate. I'm a big fan, the API is very simple and it offers lots of extendability options.
-
As a beginner which is better Redux or useContext() API?
Why don't you try out hook state
-
Redattolo, un gioco per ββββββββ in React (Next.js)
Lo stack tecnologico Γ¨ abbastanza standard per il 2022: il core Γ¨ Next.js (quindi React, 18), di store managemente se ne occupa Hookstate e per un po' di collante in piΓΉ c'Γ¨ l'event emitter / pubsub Mitt.
-
React state management libraries in 2022
I have been using Hookstate, curiously aanbidt never mentioned in lists like this.
-
What's best practice for managing state without Redux?
I've never understood why Hookstate (https://hookstate.js.org/) doesn't get more love. It's super-simple (no boilerplate), modern (hook-based), performant (works great for all size apps) and even works outside of components beautifully. It's somewhat similar to context, but more robust and feature-rich (because it's a true state management solution, which context really isn't meant to be). It's basically the only way I've done state in React for a couple of years now and I wouldn't trade it for the world.
-
Noob question, Nextjs vs CRA?
If your data requirements aren't particularly mutating / don't mutate regularly then the newer context api would be your friend it essentially variable that is scoped to your react tree which components can subscribe to changes of, but it is important to know that: unfortunately the current useContext hook (and by extension the rest of the context api) doesn't have any means of specifically "choosing" / "selecting" a part of that context state which is where it falls behind redux etc... - even though they technically operate very very similarly - both redux and context api make use of "subscriptions" to track state updates, just that the context api was designed as a means of "dependency injection" whereas redux was designed for managing state across an entire application. Passing data through props is practically the same, as before the hooks api - avoid prop drilling etc... if you're simply looking at avoiding prop-drilling and just passing some stateful value to another component thats deeply nested then context is your friend - as for redux, I personally am further inclined to hookstate as I think their api is really strong.
What are some alternatives?
nodejs-pubsub - Node.js client for Google Cloud Pub/Sub: Ingest event streams from anywhere, at any scale, for simple, reliable, real-time stream analytics.
zustand - π» Bear necessities for state management in React
emitter - Event Emitter
jotai - π» Primitive and flexible state management for React
react-recurrence - A simple, customizable, and reusable component for providing the recurrence functionality.
redux-toolkit - The official, opinionated, batteries-included toolset for efficient Redux development
create-pubsub - A tiny Event Emitter and Observable Store: https://npm.im/create-pubsub
react-hook-form - π React Hooks for form state management and validation (Web + React Native)
svelte-persisted-store - A Svelte store that persists to localStorage
unstated-next - 200 bytes to never think about React state management libraries ever again
ky - π³ Tiny & elegant JavaScript HTTP client based on the browser Fetch API
particule - Fine-grained atomic React state management library