Hi I'm a newb to reactjs and I wanted to try pulling some code from other libraries to see how it works. Unfortunately, I'm sort of stuck on trying to use the react-responsive-carousel. I realize this is a really simple question but I have been stuck on this for quite some time now and would appreciate any tips! Thank you so much!
Here is what I'm currently trying:
Index.jsx
import React from 'react';
import {render} from 'react-dom';
import AwesomeComponent from './AwesomeComponent.jsx';
import CarouselComponent from './Carousel.jsx'
class App extends React.Component {
render() {
return (
<div>
<p>Hello React!</p>
<AwesomeComponent />
<CarouselComponent />
</div>
);
}
}
render(<App/>, document.getElementById('container'));
Carousel.jsx:
import React from 'react';
import Carousel from 'react-responsive-carousel';
class CarouselComponent extends React.Component {
render() {
return (
<div>
<Carousel>
<div>
<img src="assets/1.jpeg" />
<p className="legend">Legend 1</p>
</div>
<div>
<img src="assets/2.jpg" />
<p className="legend">Legend 2</p>
</div>
<div>
<img src="assets/3.jpg" />
<p className="legend">Legend 3</p>
</div>
</Carousel>
</div>
);
}
}
export default CarouselComponent;
The error I'm seeing in the console right now is:
Warning: React.createElement: type is invalid -- expected a string (for
built-in components) or a class/function (for composite components) but got:
undefined. You likely forgot to export your component from the file it's
defined in. Check the render method of `CarouselComponent`.
in CarouselComponent (created by App)
in div (created by App)
in App