UNPKG

@told.club/sdk-rn

Version:
20 lines (16 loc) 463 B
import * as React from 'react'; import ToldContext from '../ToldContext'; export const useTold = () => { const context = React.useContext(ToldContext); if (context === undefined) { throw new Error( 'useTold needs to be used inside the ToldProvider component.' ); } return { trackScreen: context.trackScreen, sendCustomEvent: context.sendCustomEvent, close: context.close, addHiddenFields: context.addHiddenFields, }; };