I would like to know how to retain previous states or props in a certain component. We may declare a global variable and store all the states or props. It works. But some experts criticize the way using global variables in React. How can I solve this out?