- Notifications
You must be signed in to change notification settings - Fork9
Easy observable state for React ⚡️
License
alloc/wana
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Observable state with ease. ⚡️
Bring your React components to the next level. ⚛️
- Transparent proxies (no special classes)
- Implicit observation (use your objects like normal)
- Observable objects, arrays, sets, and maps (even custom classes)
- Automatic reactions to observable changes (see the
auto/useAuto/withAutofunctions) - Support for deep observation (see the
watchfunction) - Memoized derivations (see the
o/useDerivedfunctions) - Prevent unnecessary renders
- 80% less SLOC than MobX
Why build this? The goal of this library is to explore the MobX approach ofwriting React components by designing a new API from the ground up with React inmind from the get-go. Another goal is to keep a lean core by writing an observabilityengine from scratch.
Who built this?Alec Larson, the co-author ofreact-spring andimmer. You can support his work bybecoming a patron.
o()for making observable objectsauto()for reactive effectswhen()for reactive promisesno()for unobserved objectsnoto()for unobserved scopeswatch()for listening to deep changesshallowChanges()for listening to shallow changeswithAuto()for reactive componentsuseAuto()for easyautocalls in componentsuseO()for observable component stateuseDerived()for observable gettersuseChanges()for change listenersuseEffects()for reactive mounting/unmounting of effectsuseBinding()for situations wherewithAutois too invasive
The API reference can be found here:
https://github.com/alloc/wana/wiki/API-Reference
Many ofwana's exports are tree-shakeable. 🌲
@wana/babel-plugin-with-auto
For development only. It ensures thatwithAutocomponents appear in the "component stack" printed by React when an error is thrown while rendering.This makes debugging a lot easier, but also inflates the size of your application. This plugin produces broken code when used on a production bundle, because it relies on an API that exists only in development.@wana/babel-plugin-add-react-displayname
A fork ofbabel-plugin-add-react-displayname that works with Babel 7 and up. It also provides acalleesoption, which means HOCs likewithAutoare supported. Basically, this plugin sets thedisplayNameof your components for you, which makes React Devtools a better experience. It's recommended to use this plugin in both development and production.
About
Easy observable state for React ⚡️
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.