Not really sure how to do this in React, but I could see this being a problem if you're deeply nested, or rendering a lot each time.