From 75dd7d0d70aede828f7ada62f437a79115a4c989 Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Sat, 7 Sep 2019 17:29:22 +0000 Subject: [PATCH] Travis build: 42 --- snippet_data/snippetList.json | 8 ++++---- snippet_data/snippets.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/snippet_data/snippetList.json b/snippet_data/snippetList.json index 333cc26e1..d5519692d 100644 --- a/snippet_data/snippetList.json +++ b/snippet_data/snippetList.json @@ -486,7 +486,7 @@ "type": "snippetListing", "title": "useInterval", "attributes": { - "text": "A hook that implements `setInterval` in a declarative manner.\n\n- Create a custom hook that takes a `callback` and a `delay`.\n- Use the `React.useRef()` hook to create a `ref` for the callback function.\n- Use the `React.useEffect()` hook to remember the latest callback.\n- Use the `Rect.useEffect()` hook to set up the interval and clean up.\n\n", + "text": "A hook that implements `setInterval` in a declarative manner.\n\n- Create a custom hook that takes a `callback` and a `delay`.\n- Use the `React.useRef()` hook to create a `ref` for the callback function.\n- Use the `React.useEffect()` hook to remember the latest callback.\n- Use the `React.useEffect()` hook to set up the interval and clean up.\n\n", "tags": [ "hooks", "effect", @@ -494,7 +494,7 @@ ] }, "meta": { - "hash": "2a5dbbdb2da60c42a738211e43997f45fe416f4cb069fbb53b1369549f446319" + "hash": "2146f00ffd55bd78f63e0543922b73cdc339acf728067bf96f20c05eca5306ab" } }, { @@ -520,7 +520,7 @@ "type": "snippetListing", "title": "useTimeout", "attributes": { - "text": "A hook that implements `setTimeout` in a declarative manner.\n\n- Create a custom hook that takes a `callback` and a `delay`.\n- Use the `React.useRef()` hook to create a `ref` for the callback function.\n- Use the `React.useEffect()` hook to remember the latest callback.\n- Use the `Rect.useEffect()` hook to set up the timeout and clean up.\n\n", + "text": "A hook that implements `setTimeout` in a declarative manner.\n\n- Create a custom hook that takes a `callback` and a `delay`.\n- Use the `React.useRef()` hook to create a `ref` for the callback function.\n- Use the `React.useEffect()` hook to remember the latest callback.\n- Use the `React.useEffect()` hook to set up the timeout and clean up.\n\n", "tags": [ "hooks", "effect", @@ -528,7 +528,7 @@ ] }, "meta": { - "hash": "c07ecd818ad2e330d5bf4010da4464ac1aa76f1dcafec4cb7d9a8168313b68e9" + "hash": "83e13b09dccd6fa310703dfa7cc61e446fc10f1757125f2a6ad86833a4772c82" } } ], diff --git a/snippet_data/snippets.json b/snippet_data/snippets.json index abaed0aac..3aa7411a2 100644 --- a/snippet_data/snippets.json +++ b/snippet_data/snippets.json @@ -661,7 +661,7 @@ "type": "snippet", "attributes": { "fileName": "useInterval.md", - "text": "A hook that implements `setInterval` in a declarative manner.\n\n- Create a custom hook that takes a `callback` and a `delay`.\n- Use the `React.useRef()` hook to create a `ref` for the callback function.\n- Use the `React.useEffect()` hook to remember the latest callback.\n- Use the `Rect.useEffect()` hook to set up the interval and clean up.\n\n", + "text": "A hook that implements `setInterval` in a declarative manner.\n\n- Create a custom hook that takes a `callback` and a `delay`.\n- Use the `React.useRef()` hook to create a `ref` for the callback function.\n- Use the `React.useEffect()` hook to remember the latest callback.\n- Use the `React.useEffect()` hook to set up the interval and clean up.\n\n", "codeBlocks": { "style": "", "code": "const useInterval = (callback, delay) => {\n const savedCallback = React.useRef();\n\n React.useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n React.useEffect(() => {\n function tick() {\n savedCallback.current();\n }\n if (delay !== null) {\n let id = setInterval(tick, delay);\n return () => clearInterval(id);\n }\n }, [delay]);\n};", @@ -674,7 +674,7 @@ ] }, "meta": { - "hash": "2a5dbbdb2da60c42a738211e43997f45fe416f4cb069fbb53b1369549f446319" + "hash": "2146f00ffd55bd78f63e0543922b73cdc339acf728067bf96f20c05eca5306ab" } }, { @@ -707,7 +707,7 @@ "type": "snippet", "attributes": { "fileName": "useTimeout.md", - "text": "A hook that implements `setTimeout` in a declarative manner.\n\n- Create a custom hook that takes a `callback` and a `delay`.\n- Use the `React.useRef()` hook to create a `ref` for the callback function.\n- Use the `React.useEffect()` hook to remember the latest callback.\n- Use the `Rect.useEffect()` hook to set up the timeout and clean up.\n\n", + "text": "A hook that implements `setTimeout` in a declarative manner.\n\n- Create a custom hook that takes a `callback` and a `delay`.\n- Use the `React.useRef()` hook to create a `ref` for the callback function.\n- Use the `React.useEffect()` hook to remember the latest callback.\n- Use the `React.useEffect()` hook to set up the timeout and clean up.\n\n", "codeBlocks": { "style": "", "code": "const useTimeout = (callback, delay) => {\n const savedCallback = React.useRef();\n\n React.useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n React.useEffect(() => {\n function tick() {\n savedCallback.current();\n }\n if (delay !== null) {\n let id = setTimeout(tick, delay);\n return () => clearTimeout(id);\n }\n }, [delay]);\n};", @@ -720,7 +720,7 @@ ] }, "meta": { - "hash": "c07ecd818ad2e330d5bf4010da4464ac1aa76f1dcafec4cb7d9a8168313b68e9" + "hash": "83e13b09dccd6fa310703dfa7cc61e446fc10f1757125f2a6ad86833a4772c82" } } ],