Zee Zee - 10 months ago 70
React JSX Question

Uncaught TypeError: Cannot read property 'findDOMNode' of undefined when using react-bootstrap splitdown

I added a split button dropdown to my page using the example from react-bootstrap to test it out.

My code..

<SplitButton bsStyle={"primary"} title={"test"} key={1} id={`this-is-a-test`}>
<MenuItem eventKey="1">Action</MenuItem>
<MenuItem eventKey="2">Another action</MenuItem>
<MenuItem eventKey="3">Something else here</MenuItem>
<MenuItem divider />
<MenuItem eventKey="4">Separated link</MenuItem>

When clicking the split button dropdown, the console shows

Uncaught TypeError: Cannot read property 'findDOMNode' of undefined

The error points to code in the react-bootstrap.js file.

exports.default = function (componentOrElement) {
return (0, _ownerDocument2.default)(_reactDom2.default.findDOMNode(componentOrElement));

I've looked at other answers suggesting to upgrade React and React-dom, but i think my versions are ok (Both are 15.3.0).


It works in the codepen I created importing the same files. Issue must be with my implementation..

Answer Source

Make sure your import order is correct!

Place import ReactDOM from 'react-dom' before you import React Bootstrap