also could you explain a bit more on what can we consider as expensive operation? In your example with useContext you have used setState as an expensive operation. Is that just for example or actual? How do we differentiate between expensive and non-expensive operations?
Hello Jayesh, I would be happy to help you with that. Expensive operations are those operations that take longer time to execute such as complicated functions in component, API all with larger amount of data. setState can be an expensive function and we can avoid it by simply batching multiple states with single setState. we can also use useMemo() hook to decrease number of re-renders. Thanks Jayesh for your question, have a great day!!