Git Product home page Git Product logo

Comments (6)

KeKs0r avatar KeKs0r commented on May 28, 2024 1

Thank you for helping me out. I played around with the subscriptions and they are quite straight forward. I think mainly the object syntax had me slightly confused.

from react-final-form-arrays.

taneba avatar taneba commented on May 28, 2024

@KeKs0r
You can use subscription api to avoid unnecessary updates.
see: https://github.com/final-form/react-final-form-arrays#subscription-fieldsubscription

from react-final-form-arrays.

KeKs0r avatar KeKs0r commented on May 28, 2024

I am not sure how that subscriptions would look. Because, it theoretically needs to know about all of its items. But when changing one of the Single fields, I only want to rerender the single field.

Or maybe I am understanding the subscriptions wrong. Could you give me an example to achieve the same rerender behaviour as in: https://kx8qv67nk5.codesandbox.io/

from react-final-form-arrays.

taneba avatar taneba commented on May 28, 2024

@KeKs0r
Ok, here is my forked one and I added subscriptions: https://codesandbox.io/s/vmnq88nm67

You can see how the rerendering optimized by checking "Highlight Updates" in the React chrome extension. It shows only one field that you typing is rerendered. Also, the stringified JSON in the <pre> rerendered because I added <FormSpy> which subscribe values.
Is this exactly what you want to achieve?

from react-final-form-arrays.

KeKs0r avatar KeKs0r commented on May 28, 2024

Yes this was, what I was looking for. I am wondering, whether I am losing some rerenders, that are expected? Such as for pristine etc.?

But it looks very promising.

from react-final-form-arrays.

taneba avatar taneba commented on May 28, 2024

I am wondering, whether I am losing some rerenders, that are expected? Such as for pristine etc.?

Yes, if you don't set any properties to subscription then <Form /> or <FieldArray /> won't rerender by changing form state. That's how subscription works.

from react-final-form-arrays.

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.