gpt4 book ai didi

reactjs - 将 react 应用程序与 react native 应用程序合并

转载 作者:行者123 更新时间:2023-12-03 13:31:17 24 4
gpt4 key购买 nike

我想将 React 应用程序文件放入 React Native 应用程序中。

我用了React Native Web支持 React 应用程序中的 React Native 组件。

最后一步,我想将 React App 文件夹中的所有文件放入 React Native App 文件夹中。

差异在于 Package.json

react 包.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"
}
}

那么我可以将这两个包合并在一起吗?

最佳答案

对于您的 native 应用程序,您可以使用 React Native 中的 package.json,无需合并。您不需要 native 应用程序中的“react-dom”和类似的库。如果你的组件全部来自React Native for Web,那么在原生上运行它们就不会有问题。

关于reactjs - 将 react 应用程序与 react native 应用程序合并,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45561249/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com