DEV Community

James Zhan
James Zhan

Posted on

How can I update a class component in SyncLane?

In react 18 concurrency, sometime we want to specify a higher priority for UI update triggered by external store.

This can be done for function component by using useSyncExternalStore that when the external store updates, react will update the UI in SyncLane.

However, I can't find any information on how to make class component's forceUpdate to be in SyncLane.

In react experimental version, I can use unstable_runWithPriority API to achieve the effect I want. Is there a more stable way to do it?

Top comments (0)