With this custom hook, you can easily use and customize the behavior of any videoask video!
$ yarn add react-videoask-hook
# or
$ npm install react-videoask-hook
import { VideoAskProvider } from 'react-videoask-hook';
const App = () => {
const videoAskConfig = {
kind: 'widget',
url: 'https://www.videoask.com/<video-id>',
options: {
widgetType: 'VideoThumbnailWindowTall',
position: 'bottom-left',
},
};
return (
<VideoAskProvider config={config}>
<p>My awesome app</p>
</VideoAskProvider>
);
};
import { VideoAskProvider } from 'react-videoask-hook';
const App = () => {
const videoAskConfig = {
kind: 'widget',
url: 'https://www.videoask.com/<video-id>',
options: {
widgetType: 'VideoThumbnailWindowTall',
position: 'bottom-left',
},
};
return (
<VideoAskProvider
config={config}
callbacks={{
onMessage(params) {
console.log(params);
},
onLoadModal() {
console.log('on-load-modal');
},
onCloseModal(removeWidget) {
console.log('on-close-modal');
},
}}
>
<p>My awesome app</p>
</VideoAskProvider>
);
};
import { useVideoAsk } from 'react-videoask-hook';
const MyComponent = () => {
const { showWidget, hideWidget } = useVideoAsk();
return (
<>
<button onClick={showWidget}>Show video ask</button>
</>
);
};
Todo |