nerdyman / react-image-turntable

Display a set of images as a draggable 360 degree turntable.
https://githubbox.com/nerdyman/react-image-turntable/tree/main/example
MIT License
21 stars 1 forks source link

Add hook to control all state from parent #24

Open nerdyman opened 7 months ago

nerdyman commented 7 months ago

Add useReactImageTurntable hook to expose internal functions to the parent component. This will allow the parent component to hook into the internal logic of the component, simplifying state management.

Props should be passed to the hook instead of directly to the component.

Example usage

import { ReactImageTurntable, useReactImageTurntable } from 'react-image-turntable'; 

const Example = () => {
  const turntableProps = useReactImageTurntable({ autoRotate: { interval: 200 } });

  return <ReactImageTurntable {...turntableProps} />
}