-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathDefault.jsx
More file actions
28 lines (25 loc) · 719 Bytes
/
Default.jsx
File metadata and controls
28 lines (25 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import React, { useState } from 'react'
import Flickity from '../src/index.js'
import { images } from './images.js'
export default function Default() {
const [imgs, setImages] = useState(images)
function addImage() {
const newImages = [...imgs]
newImages.push('https://picsum.photos/200/300')
setImages(newImages)
}
return (
<>
<h3>Default</h3>
<pre>
<Flickity>{children}</Flickity>
</pre>
<p className="carousel">
<Flickity >
{imgs.map(image => <img src={image} key={image} className="carousel-image"/>)}
</Flickity>
</p>
<button onClick={addImage}>Add image to carousel</button>
</>
)
}