-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I'm developing an app and trying to import this library to use it. I've installed it using Yarn and I'm using Webpack to bundle it up along with my other dependencies.
I have a simple React component JSX file like this:
import * as React from 'react';
import TreeView from 'react-bootstrap-treeview/public/js/react-bootstrap-treeview';
//noinspection JSUnusedLocalSymbols
export default function SideBar (_: {}) {
return (
<TreeView/>
);
}When I try to render this, I get an error "React is not defined" coming from "react-bootstrap-twitter.js". The reason is that it expects "React" to be a globally defined variable.
For reference, this is the start of "react-bootstrap-twitter":
var TreeView = React.createClass({displayName: "TreeView",
propTypes: {
levels: React.PropTypes.number,
expandIcon: React.PropTypes.string,
// ...I'm pretty new to web stuff and I have no idea how to make React globally available within my app, but wouldn't it make more sense to declare React as a peer dependency and import/require it at the top of the file?
Is there a way I can adapt my code to let me use TreeView?
Metadata
Metadata
Assignees
Labels
No labels