React 组件不会渲染,因为 bootstrap
React component won't render, because of bootstrap
这是我的组件:
import React from 'react';
import {Col, Panel, Input, ButtonInput} from 'react-bootstrap';
const EditItem = ({content}) => (
<Col xs={12} sm={6} smOffset={3}>
<Panel>
<h1> Edit Item </h1>
<form>
<Input type="text" placeholder="Name of the place" />
<Input type="textarea" placeholder="Description" />
<ButtonInput bsStyle="primary" type="submit" value="Save Item"/>
</form>
</Panel>
</Col>
);
export default EditItem;
我以类似的方式构建了我的所有组件,并且它们运行良好。除了 Input 和 ButtonInput 导入之外,该组件与其他运行良好的组件非常相似。我的控制台得到以下输出:
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of `EditItem`.
因为我得到了三个,我猜每个 Input 或 ButtonInput 标签都有一个错误。
我也在控制台中收到此消息:
invariant.js:39 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `EditItem`.(…)
我是按照教程一步一步来的,教程中的代码和我的是一样的。考虑到其他 bootstrap 元素工作正常,我的依赖项都已正确安装。知道我错过了什么吗?
在版本 0.30.6 中,既没有 Input
也没有 ButtonInput
组件。
确保使用与教程中使用的版本相对应的 react-bootstrap 版本。
0.30.6 是最后一个版本,您可以在 http://react-bootstrap.github.io/
上找到所有需要的文档
这是我的组件:
import React from 'react';
import {Col, Panel, Input, ButtonInput} from 'react-bootstrap';
const EditItem = ({content}) => (
<Col xs={12} sm={6} smOffset={3}>
<Panel>
<h1> Edit Item </h1>
<form>
<Input type="text" placeholder="Name of the place" />
<Input type="textarea" placeholder="Description" />
<ButtonInput bsStyle="primary" type="submit" value="Save Item"/>
</form>
</Panel>
</Col>
);
export default EditItem;
我以类似的方式构建了我的所有组件,并且它们运行良好。除了 Input 和 ButtonInput 导入之外,该组件与其他运行良好的组件非常相似。我的控制台得到以下输出:
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of `EditItem`.
因为我得到了三个,我猜每个 Input 或 ButtonInput 标签都有一个错误。
我也在控制台中收到此消息:
invariant.js:39 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `EditItem`.(…)
我是按照教程一步一步来的,教程中的代码和我的是一样的。考虑到其他 bootstrap 元素工作正常,我的依赖项都已正确安装。知道我错过了什么吗?
在版本 0.30.6 中,既没有 Input
也没有 ButtonInput
组件。
确保使用与教程中使用的版本相对应的 react-bootstrap 版本。
0.30.6 是最后一个版本,您可以在 http://react-bootstrap.github.io/
上找到所有需要的文档