我在Flow类型检查中得到了以下错误.
Cannot call ReactDOM.render with document.getElementById(...) bound to container because null [1] is
incompatible with Element [2].
src/index.js
26? </Switch>
27? </ScrollToTop>
28? </BrowserRouter>
29? </Provider>, document.getElementById("root"));
30?
/private/tmp/flow/flowlib_174a8121/dom.js
[1] 646? getElementById(elementId: string): HTMLElement | null;
/private/tmp/flow/flowlib_174a8121/react-dom.js
[2] 18? container: Element,
Run Code Online (Sandbox Code Playgroud)
代码如下.
// @flow
"use strict";
import React from "react";
import ReactDOM from "react-dom";
import {createStore, applyMiddleware} from "redux";
import {Provider} from "react-redux";
import {BrowserRouter, Switch, Route} from "react-router-dom";
import Home from "./components/home";
import Detail from "./components/detail";
import LevelOfGame from …Run Code Online (Sandbox Code Playgroud) 我正在使用Material-UI版本1在我的React应用程序中制作网格UI。我想使网格响应。GridList组件API具有cols属性,默认情况下为2。
例如,如下所示。
<GridList cols={1} spacing={32} className="list"></GridList>
Run Code Online (Sandbox Code Playgroud)
我可以动态更改道具吗?还是有其他方法使其具有响应性?
当我尝试在 React Native 项目中构建 Android 应用程序时出现构建错误。
当我运行时react-native run-android,它说:
> Configure project :react-native-os
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-os'.
> compileSdkVersion is not specified.
Run Code Online (Sandbox Code Playgroud)
在 Android Studio 中,我可以看到它说的是同样的话:
Cause: compileSdkVersion is not specified.
所以我在 Android Studio 中编辑了 build.gradle(Module: app) 文件,但问题仍然存在,错误信息没有改变。
android { …Run Code Online (Sandbox Code Playgroud) android android-gradle-plugin react-native react-native-android