I have a React Carousel with 4 images for example.
import React from 'react'
import { FacebookShareButton } from "react-share";
import img1 from './images/kitten/200.jpg'
import img2 from './images/kitten/201.jpg'
import img3 from './images/kitten/202.jpg'
import img4 from './images/kitten/203.jpg'
const imageList = [img1, img2, img3, img4]
class App extends Component {
constructor(props) {
super(props)
this.selected = "";
}
render() {
return (
<div>
<Carousel>
{imageList.map((each) => (
<img src{each} />
))}
</Carousel>
</div>
)
}
}
export default App;
I would like to pick one image from the slider
And push it in new variable defined above called this.selected
Thanks