Giter Site home page Giter Site logo

Comments (6)

dai-shi avatar dai-shi commented on May 18, 2024 2

Hey, this is interesting. Can we drop proxyWithComputed if we support chaining addComputed?

from valtio.

dai-shi avatar dai-shi commented on May 18, 2024

Maybe not. I don’t have an idea yet to support nested computeds with addComputed.

from valtio.

thelinuxlich avatar thelinuxlich commented on May 18, 2024

If it's possible to add multiple computeds in a single call, I'd say yes

from valtio.

dai-shi avatar dai-shi commented on May 18, 2024

OK, I might need to change a signature significantly. It's more for #85. Let's see how you like it.

from valtio.

dai-shi avatar dai-shi commented on May 18, 2024

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.

thelinuxlich avatar thelinuxlich commented on May 18, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.