React-Bootstrap dropdown not expanding

前端 未结 5 498
攒了一身酷
攒了一身酷 2021-01-02 08:22

I\'ve just started implementing React-Bootstrap in my site, but the NavDropdown component will not expand when clicking on it.

What I did: npm install -s react

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-02 08:50

    Be sure to install react-dom $ npm install --save react react-dom and import "render", that should get it working. It's a requirement according to React-Bootstrap Getting Started page

    I'm currently using React-Bootstram in one of my projects, these are the imports that work for me:

    import React, { Component } from 'react';
    import ReactDOM, {render} from 'react-dom';
    import PropTypes from 'prop-types';
    import { Nav, Navbar, NavItem, MenuItem, NavDropdown, Modal, Jumbotron } from 'react-bootstrap';
    

    I hope this helps.

提交回复
热议问题