使用React Bootstrap获取不变违规

时间:2016-09-01 12:49:25

标签: reactjs react-bootstrap

以下代码给了我一个var date = new Date(); var dateFormatted = (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear(); $("[data-date]").each(function() { var newDate = new Date($(this).attr("data-date")); if (newDate == date) { // dates are equal code } else if (newDate > date) { // date in future code } else { // date passed code } } 。我不知道为什么。它几乎完全是从Bootstrap示例中复制的。

Uncaught Invariant Violation

Uncaught Invariant Violation: 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 'LoginForm'.

1 个答案:

答案 0 :(得分:0)

您需要从react-boostrap导入这些组件,这些组件是定义它们的实际包,而不是从.css文件中导出的 - 它们没有任何React组件,只有样式(这就是为什么你得到了未定义的东西。)

import { FormGroup, ControlLabel, FormControl, HelpBlock, Button } from 'react-bootstrap'