react-chrome-extension-boilerplate icon indicating copy to clipboard operation
react-chrome-extension-boilerplate copied to clipboard

Same store, different root

Open altany opened this issue 7 years ago • 0 comments

I added an extra view for the new tab and it works great! Also, I updated the popup view to render a form for adding a new item to the list. All works great but I still need to refresh the new tab window to see the new item.

What I would like to do is have the new item show automatically in the new tab list when I add it via the popup. Does anyone know if I can make it work without refresh?

For reference, I replaced #root with #popupRoot in popup.pug, and then edited todoapp.js as:

...

const createStore = require('../../app/store/configureStore');
const store = createStore(initialState);

if (document.querySelector('#root')) {
    ReactDOM.render(
      <Root store={store} />,
      document.querySelector('#root')
    );
  }
  if (document.querySelector('#popupRoot')) {
    ReactDOM.render(
      <PopupRoot store={store}/>,
      document.querySelector('#popupRoot')
    );
  }

altany avatar Mar 31 '17 14:03 altany