react-focus-trap icon indicating copy to clipboard operation
react-focus-trap copied to clipboard

undefined import

Open micheledisalvatore opened this issue 7 years ago • 1 comments
trafficstars

I'm working on a typescript react project where I've installed react-focus-trap via yarn yarn add react-focus-trap and I can see into the package.json "react-focus-trap": "^2.7.1",.

In my code I'm using it:

// ...
import FocusTrap from 'react-focus-trap';
// ...

class Modal extends React.Component<ModalProps, any> {
	// ...

	render() {
		return <FocusTrap className='modal'><div /></FocusTrap>
	}
}

Debugging it, I can see that FocusTrap is undefined and react is generating this error:

warning.js?85a7:33 Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of `Modal`.

Any idea on this error?

micheledisalvatore avatar Nov 07 '18 17:11 micheledisalvatore

Huh. I'll take a look. It's possible that I got something wrong. We're consuming this module on ars-arsenal, another project of ours without an issue. It'd be great to know if our configuration isn't correct.

I can take a look later this week :)

nhunzaker avatar Nov 07 '18 22:11 nhunzaker