如何在create-react-app中使用EXPO INIT的View功能?

How to use EXPO INIT's View function in create-react-app?

我使用由 facebook 社区

开发的 create-react-app 创建了我的项目

如何使用在 expo init 项目中工作的代码,例如使用 View in create-react-app 项目:

import React from 'react';
import ReactDOM from 'react-dom';
class Spalsh extends React.Component {

    constructor(props) {
        super();
    }

    render() {
        return (
            <View></View>
        )
    }
}

因为在尝试添加这个库时import {View} from "react-native"; 运行 错误

一件事是 create-react-app,另一件事是 expo。 Expo 是 React Native 的一个模块!而cra是facebook使用React开发的一个用于创建web应用的模块。

如果您想要构建和 APK 或 IOs 应用程序,您必须需要 react-native,按照下一个教程设置开发环境 https://reactnative.dev/docs/environment-setup