microsoft / Mezzurite

Your components, timed.
Other
61 stars 10 forks source link

Support for React Reach Router #42

Open dpiessens opened 5 years ago

dpiessens commented 5 years ago

We're using the Reach Router instead of the react router. Our routing is simple and reach meeting some specific needs we have. This however causes messurite-react to fail even if we don't use the withMezzuriteRouter(). It looks like the wrapper could work with Reach, but I'm not sure how to make the core import optional and not fail.

brrusino commented 5 years ago

It looks like Reach exposes LocationProvider, which sets up a listener to location changes. This could be extended to capture ALT start/VLT end similar to withMezzuriteRouter - want to give that a try? Also regarding the failures you're seeing without withMezzuriteRouter implemented, can you post the error you're seeing in the console?

dpiessens commented 5 years ago

Sure I can give that a try.

Here's the error when I just wrapped one of my components without the router annotated: ERROR in ./node_modules/@microsoft/mezzurite-react/esm/mezzurite-react.js Module not found: Error: Can't resolve 'react-router' in 'C:\Projects\reveal\client\Reveal.UI.Web\client\node_modules\@microsoft\mezzurite-react\esm' @ ./node_modules/@microsoft/mezzurite-react/esm/mezzurite-react.js 5:0-42 212:11-21 @ ./app/workitems/components/WorkItemsListView/WorkItemsListView.jsx @ ./app/workitems/containers/WorkItemsListView/WorkItemsListView.jsx @ ./app/common/containers/App/App.jsx @ ./app/index.jsx @ multi webpack-hot-middleware/client @babel/polyfill whatwg-fetch ./app/index.jsx

All I did for the component was: import {withMezzurite} from '@microsoft/mezzurite-react'; ... export default withMezzurite(WorkItemsListView);

brrusino commented 5 years ago

Just opened bug #43 to track this issue.