Ask Your Question
2

I am confused about optimizing re-rendering in React context. Does it stop the context subscriber from re-rendering?

asked 2023-06-10 23:43:30 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-06-10 23:44:01 +0000

djk gravatar image

Optimizing re-rendering in React context can help reduce unnecessary re-renders, but it does not completely stop the context subscriber from re-rendering. It helps improve performance by selectively re-rendering only the necessary components that depend on the updated context values. However, if the context value changes, all the components that are subscribed to it will re-render. Therefore, it is important to carefully choose what data is stored in the context and how it is updated to minimize unnecessary re-renders.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-10 23:43:30 +0000

Seen: 13 times

Last updated: Jun 10 '23