Suppose I have component1 which has a state that I want to share with component2, now component2 is being rendered by a button component (not html button) by using useHistor