私はTypeScript(1.8.10)を使用しており、学習は反応しています。 React-Bootstrapを使って簡単なナビゲーションを作成していますが、次のようなエラーが表示されています。このエラーは、DOMがレンダリングされないようにします。私は全く新しい反応を示すので、ここで間違っていることを確かめないでください。このエラーを回避するための助けや指導をいただき、ありがとうございます。Typescript React React.createElement:typeはnull、未定義、ブール値、または数値であってはなりません。
// A '.tsx' file enables JSX support in the TypeScript compiler,
// for more information see the following page on the TypeScript wiki:
// https://github.com/Microsoft/TypeScript/wiki/JSX
/// <reference path="./../../../typings/index.d.ts" />
import * as React from 'react';
import * as ReactBootstrap from 'react-bootstrap';
interface INavigationProps {
}
let Navbar = ReactBootstrap.Navbar;
let NavItem = ReactBootstrap.NavItem;
let MenuItem = ReactBootstrap.MenuItem;
let NavbarHeader = ReactBootstrap.NavbarHeader;
const dropdownItems = [
{ href: '#', name: 'Overview' },
{ href: '#', name: 'Setup' },
{ href: '#', name: 'Usage' },
];
export default class Navigation extends React.Component<INavigationProps, {}> {
render() {
return (
<Navbar>
<NavbarHeader href="homepage.html" name="Website Name"/>
<NavItem>
<MenuItem link="about.html" title="About" />
<MenuItem link="contact.html" title="Contact" />
<MenuItem link="services.html" title="Services" />
</NavItem>
</Navbar>
);
}
}
// A '.tsx' file enables JSX support in the TypeScript compiler,
// for more information see the following page on the TypeScript wiki:
// https://github.com/Microsoft/TypeScript/wiki/JSX
/// <reference path="./../../typings/index.d.ts" />
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as ReactBootstrap from 'react-bootstrap';
import HeaderNavigation from "./NavigationComponent/navigation";
import Hello from "./HelloComponent/Hello";
ReactDOM.render(
<div>
<HeaderNavigation />
<Hello name="Athraya" />
</div>,
document.getElementById("root")
);
での作業の例では、 'Navigation'、ない' HeaderNavigation'という名前のコンポーネントではないですか? – Li357
@andrew headernavigationは、あなたが見ることができるように、ナビゲーションモジュールを指しているラベルです –