Questions tagged [react-custom-hooks]

146 questions
0
votes
0 answers

Testing custom hook React

I created a hook export function useRedirectStartParams() { const scenarios: IScenario[] = useSelector(scenariosSelector); const block: IBlockItem = useSelector(selectedBlockSelector); const [redirects, setRedirects] =…
0
votes
1 answer

How to execute React custom hook only when data is available or Apollo client loading is false

I have custom React hook which adding some scripts and add a variable to window object: const useMyHook = ({ id, type }: Props) => { useScript('https:domain/main.js'); useScript('https://domain/main2.js'); useEffect(() => { window.mydata…
meez
  • 3,783
  • 5
  • 37
  • 91
0
votes
1 answer

How create a custom React hook and combine the logic from my (helper) functions

I created below two functions, to add and remove external src and