i have created an application from create-react-app and it works well. When I added react-navitation I got this error:
./node_modules/react-navigation/src/routers/StackActions.js
Module parse failed: Unexpected token (10:2)
You may need an appropriate loader to handle this file type.
| const pop = payload => ({
| type: POP,
| ...payload,
| });
|
It seens we don't have "transform-object-rest-spread" babel plugin. Could someone knows how may I add it?
this is my dependencies inside package.json:
"dependencies": {
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-navigation": "^2.6.2",
"react-scripts": "1.1.4"
}
From this issue: https://github.com/react-navigation/react-navigation/issues/3516
we don't explicitly support web or reactxp currently. if you'd like to submit a RFC for how we could do that and own it, it would be nice. it's not a priority right now. so this is more of a feature request than a bug. sorry :(
See also this section of their docs.
TL;DR -- they ship un-transpiled code and are targeting React Native. I would suggest looking at alternatives, such as the tried-and-true react-router, or a newer one from one of the original authors, reach-router.