react-image-turntable icon indicating copy to clipboard operation
react-image-turntable copied to clipboard

Add hook to control all state from parent

Open nerdyman opened this issue 2 years ago • 0 comments

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} />
}

nerdyman avatar Nov 26 '23 16:11 nerdyman