我想将React app文件放在React Native应用程序中。
我使用React Native Web来支持React应用程序中的React Native组件。
最后一步我想将React App文件夹中的所有文件放到React Native App文件夹中。
区别在于Package.json
React Package.json:
{
"name": "appname",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-scripts": "1.0.10"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
React Native Package.json:
{
"name": "appname",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.47.1",
"react-native-windows": "0.47.0-rc.5"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.1.0",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12",
"rnpm-plugin-windows": "^0.2.7"
},
"jest": {
"preset": "react-native"
}
}
那么我可以将两个包合并在一起吗?
答案 0 :(得分:1)
对于您的本机应用程序,您可以使用React Native中的package.json,无需合并。你不需要" react-dom"本机应用程序中的类似库。如果您的组件都来自React Native for Web,那么在本机上运行它们就没有问题了。