小编Aka*_*rma的帖子

如何在 TypeScript 项目中使用 React-Bootstrap

我正在尝试使用react-bootstrap制作导航栏我已经安装了节点模块,"@types/react-bootstrap": "^0.32.11",我想在我的hello.tsx组件中使用它,但它显示编译错误模块未找到:错误:无法解析'react- bootstrap' in:\Query Express\Portal\src\components' 我不明白为什么它在组件目录中寻找react-bootstrap

import * as React from "react";
import { Navbar, Nav, NavItem, NavDropdown, MenuItem } from "react-bootstrap";

export interface IHelloProps { compiler: string; framework: string; }

// 'helloProps' describes the shape of props.
// state is never set so we use the '{}' type.
export class Hello extends React.Component<IHelloProps, {}> {
    render() {
        return(
        <div>
            <Navbar inverse>
  <Navbar.Header>
    <Navbar.Brand>  
      <a href="#brand">React-Bootstrap</a>
    </Navbar.Brand>
    <Navbar.Toggle />
  </Navbar.Header>
  <Navbar.Collapse>
    <Nav>
      <NavItem eventKey={1} href="#">
        Link
      </NavItem>
      <NavItem …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs react-bootstrap

6
推荐指数
2
解决办法
3万
查看次数

标签 统计

react-bootstrap ×1

reactjs ×1

typescript ×1