无法将React-bootstrap-treeview导入.tsx文件

时间:2018-02-01 21:21:44

标签: reactjs webpack treeview

我正在尝试导入https://github.com/jonmiles/react-bootstrap-treeview作为模块,我不断获取[ts] Cannot find module 'react-bootstrap-treeview'.我不确定如何导入没有正确导出语句的文件/项目。我在tsconfig.json中使用了es5目标

import * as React from "react";
import * as TreeView from 'react-bootstrap-treeview';

export class Nav extends React.Component<any, any> {
     constructor(props:any) {
        super(props);
     }

     componentWillMount() {
     }


     render() {

      // just quick and dirty var to test my nav
      var data = [
        {
          text: "Parent 1",
          nodes: [
            {
              text: "Child 1",
              nodes: [
                {
                  text: "Grandchild 1"
                },
                {
                  text: "Grandchild 2"
                }
              ]
            },
            {
              text: "Child 2"
            }
          ]
        },
        {
          text: "Parent 2"
        },
        {
          text: "Parent 3"
        },
        {
          text: "Parent 4"
        },
        {
          text: "Parent 5"
        }
      ];

         return <div className="nav">
            <TreeView data={data} />
         </div>
     }
}

0 个答案:

没有答案