I have a shopping cart where i add and remove items, and i keep data in the `localStorage`.

I add my items like this:

```
const addItemToCart = (item: Object) => {
    if (typeof window === 'undefined') return;

    let myCart = JSON.parse(localStorage.getItem('myCart') || '[]');
    myCart.push(item);
    localStorage.setItem('myCart', JSON.stringify(myCart));
  };

```

The shopping cart is different component and i need to call in that single component `getItem()` every time i add item to cart.

Is there a way to watch attribute in localStorage? Because only way i see is to create some context.