React: Implement Silent Updates in the State Update Queue

Created on 31 Aug 2017  路  6Comments  路  Source: facebook/react

Reason React has silent updates. Meaning it's a normal update in the state queue that can be reverted. The only difference is, it doesn't need a rerender by itself. If props have changed, it does rerender.

Unclear if we expose this to the existing ClassComponent API or make it a feature of new APIs.

React Core Team Feature Request

Most helpful comment

I like the idea of introducing a new component type that serves as a target for both Reason React and for the compiler experiments that @trueadm is doing. We can mark it as unstable for now. This will let us try out new APIs at a faster pace than our usual release cycle. Our ongoing async investigations could also benefit from this.

All 6 comments

Thanks for the follow-up. No strong opinion since this is a power-user feature, but for the sake of reactjs itself and the js users, let's keep the API minimal, As always.

Cc @jordwalke

I like the idea of introducing a new component type that serves as a target for both Reason React and for the compiler experiments that @trueadm is doing. We can mark it as unstable for now. This will let us try out new APIs at a faster pace than our usual release cycle. Our ongoing async investigations could also benefit from this.

Or, short of introducing a whole new component type, this.unstable_setSilentState could be sufficient for this case. But it seems like we have several projects that could benefit from an experimental component API surface.

@acdlite this.unstable_setSilentState wouldn't be sufficient for RR since it's the reducer that determines whether it is silent or not.

Mmm, I see

If I recall correctly, in RR it's determined by the return type?

Was this page helpful?
0 / 5 - 0 ratings