monocle-ts
valtio
Our great sponsors
monocle-ts | valtio | |
---|---|---|
7 | 47 | |
1,016 | 8,429 | |
- | 2.8% | |
0.0 | 7.9 | |
over 1 year ago | 16 days 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.
monocle-ts
-
Deep Cloning Objects in JavaScript, the Modern Way
Instead of the "deep path properties" syntax, you might want to take the opportunity to learn about functional lenses with monocle-ts
https://gcanti.github.io/monocle-ts/
-
I may have a crush on the TypeScript compiler, because of stuff like this
You may be interested also in checking out the implementation of Lens in monocle-ts, one of the libraries in the fp-ts ecosystem
-
Haskell Lens Tutorial by Exercises
For anyone - anyone who's faffed around with JavaScript's spread syntax when working with nested immutable data, anyway - struggling to understand the general concept or utility of lenses, I'd encourage looking into monocle-ts. The motivation [0] that kicks off the README instantly made me a believer, and TypeScript's idiosyncratic type system makes using the library remarkably natural; it fits right in without needing to deal with anything analogous to Template Haskell.
[0] https://github.com/gcanti/monocle-ts#motivation
-
Is there a cleaner way to immutably update a deeply nested attribute? (I feel like this is not very clean)
You could have a look at the monocle-ts library. It was designed to deal with this kind of problem.
-
Simple Immutable Data w/ Spectacles ๐
spectacles-ts integrates seamlessly with the fp-ts ecosystem (it's built on top of the excellent monocle-ts library)
-
Why is it so difficult to modify a deeply nested state in React?
lenses help with this quite a bit, check out monocle-ts
-
You could have invented lenses!
You notice that Getters are composable as they are just pure functions, but the fact that setters are mutating values is not that nice. Tho, at this point we have invented quasi mutable lenses and If you really want you might invent actual purely functional lenses as well, but thatโs for another day. Meanwhile you can take a look at an actual typescript lesses library from @gcanti / monocle-ts.
valtio
- 5 Alternatives to Redux for React State Management
- How to properly structure a valtio shared state object?
-
Changelog #0023 โ ๐ ๏ธ Internal refactoring and improvements
We took inspiration from the many frameworks we worked with throughout our careers. And maybe surprisingly, Djangoโs ORM layer impacted our design choices and the API quite a bit. The resulting framework relies on Zod for schemas and validation and Valtio for React integration.
-
Is redux and thunks still used or are there other alternatives for it now?
Valtio is like simplified MobX
-
Why is building a UI in Rust so hard?
Even simpler than Zustand are state-atom libraries like jotai or recoil, or proxy based ones like valtio. Here's some discussion about the differences.
-
How to implement state management inside a simple JavaScript app
There is a package developed around this proxy concept called Valtio which is available for JavaScript, React, and so on... feel free to check and star it on Github.
-
What is being used right now for ioc/state-managment?
I'm switching from redux-saga to valtio (https://github.com/pmndrs/valtio) for now. It's simple and easy to use, everything's great so far.
-
Ask HN: What is your favorite front end state management solution?
I like valtio, works w/ React or just js. Has subscribe, derive, and more.
https://github.com/pmndrs/valtio
-
Explanation on how Redux or React Context could help and picking the best option
Jotai and Valtio are both also really good. Recently looked at Nanostore as well and has some similarity to Jotai and Recoil.
-
Notes on LiveView Components and JS interactions
Since we want the React component to react to an external change, using a state manager makes this easy. We will use Valtio here by example. For this library, change the esbuild config to --target=es2020 instead to remove some warnings (for example, the Zustand library is ok).
What are some alternatives?
optics-ts - Type-safe, ergonomic, polymorphic optics for TypeScript
redux - A JS library for predictable global state management
zustand - ๐ป Bear necessities for state management in React
MobX - Simple, scalable state management.
spectacles-ts - Practical Optics โข Unfancy monocle-ts
immutability-helper - mutate a copy of data without changing the original source
Immer - Create the next immutable state by mutating the current one
fp-ts-contrib - A community driven utility package for fp-ts
jotai - ๐ป Primitive and flexible state management for React
fp-ts - Functional programming in TypeScript
leva - ๐ React-first components GUI