() => {
const [list, setList] = useState([1, 2, 3, 4, 5])
const { ref } = useSlider()
return (
<>
<button onClick={() => setList(prev => [...prev, prev.length + 1])}>
Add New Item
</button>
<div ref={ref}>
{list.map(item => (
<div key={item}>{item}</div>
))}
</div>
</>
)
}