The React doc states clearly that useState hook returns distinct values, but I still see some devs confused about whether they are working with a shared/global state, when useState is placed inside a custom hook I put together a very simple codepen to illustrate that each call to the use hook function does indeed get you a distinct piece of state, which is nice! If you really want shared state, hello Redux (or ahem, Context) ! https://codepen.io/binodpanta/pen/vYWdxMd Have fun with React! ⌣
You may have seen this question, center a div, or whatever, in interviews or other places. I am sure there are other approaches than I am sharing here, but I found these two cool ideas from multiple places (see refs at the end). These are not my original ideas so I will be sure to share where I learned these from: Using display:flex Make sure you know how flex works, but to do centering with flex, it's ridiculously simple: div .container { display : flex ; justify-content : center ; /* horizontal alignment */ align-items : center ; /* vertical alignment */ flex-direction : column ; /* since we are doing a vertical column */ padding : 1rem 3rem ; /* not related to centering */ } Now everything inside <div class="container"> </div> will be centered in both directions! Using display:grid You are so going to thank for me this one, you are welcome. This one is so simple it does not even need an explanation does it? div .container {