Comments (6)
Hey, this is interesting. Can we drop proxyWithComputed if we support chaining addComputed?
from valtio.
Maybe not. I don’t have an idea yet to support nested computeds with addComputed.
from valtio.
If it's possible to add multiple computeds in a single call, I'd say yes
from valtio.
OK, I might need to change a signature significantly. It's more for #85. Let's see how you like it.
from valtio.
Hmm, my challenges are not very successful.
https://github.com/pmndrs/valtio/tree/feat/add-computed
The result doesn't seem to be very handy as it still requires proxyWithComputed
.
https://github.com/pmndrs/valtio/tree/feat/add-computed-2
This one can't support computed setters.
In either case, nested computed is tricky with typescript.
Is there a real use case to add computed afterward?
from valtio.
@dai-shi IMO the first branch accomplishes the feature, although not as you'd like (deprecating proxyWithComputed)
Real use cases:
- Augmenting a state tree with reactive/computed fields through plugins(or mixins)
- Dynamic reactive/computed field generation(through a CMS, smart form generator, etc)
from valtio.
Related Issues (20)
- Derive working with single derived property, but failing with two HOT 10
- [DOCS]: wrong API url links HOT 1
- [DOCS]: React fans Discord invalid invitation HOT 1
- `use-sync-external-store` should be marked as a `peerDep` HOT 7
- synchronous partial state update Interface HOT 1
- Consuming a valtio proxy from another package results in "TypeError: proxyState is not iterable" HOT 1
- Cache key could refer previous value HOT 18
- About Rerendering ,Is it a bug or my usage error,Request help HOT 1
- There is a defect in the ref in proxyWithHistory HOT 1
- Typescript & devtools HOT 1
- Vanilla `subscribe` does not trigger when a computed getter is updated HOT 2
- Branded primitive types are incompatible with Snapshot<T> HOT 8
- Snapshots can be mutated by adding or removing properties HOT 2
- bug when filtering data
- replace object not trigger render HOT 3
- defineProperty trap makes property non-CEW in React Native (Hermes engine) HOT 10
- proxyState is not iterable
- tsc fails when using functions in valitio/utils
- use class throw error
- [Warning] Please install/enable Redux devtools extension
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from valtio.