ctrlplusb / react-tree-walker

Walk a React (or Preact) element tree, executing a "visitor" function against each element.
MIT License
345 stars 34 forks source link

Trying to run this with MobX returns error. #21

Closed mhaagens closed 6 years ago

mhaagens commented 6 years ago
reactTreeWalker(
  <Provider store={store}>
    <Router location={req.url} context={context}>
      <App userAgent={userAgent} />
    </Router>
  </Provider>, () => { 
    return true;
  }
)

returns this error;

Error walking your react tree
TypeError: Cannot read property 'mobxStores' of undefined
ctrlplusb commented 6 years ago

Hmmm, looks like context is not being passed down.

MobX, also, to my memory requires that the componentWillUnmount be called. There is a thread on react-universally about MobX support:

https://github.com/ctrlplusb/react-universally/issues/408

mhaagens commented 6 years ago

Ah, looks like #408 might contain the solution. Thanks!