()
| 33 | const CarouselContext = React.createContext<CarouselContextProps | null>(null); |
| 34 | |
| 35 | function useCarousel() { |
| 36 | const context = React.useContext(CarouselContext); |
| 37 | |
| 38 | if (!context) { |
| 39 | throw new Error('useCarousel must be used within a <Carousel />'); |
| 40 | } |
| 41 | |
| 42 | return context; |
| 43 | } |
| 44 | |
| 45 | const Carousel = React.forwardRef< |
| 46 | HTMLDivElement, |