From 4ebe525fcefab48d30f8d7f8417e39c8faf0392e Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Fri, 3 Jan 2020 13:57:59 +0000 Subject: [PATCH] Travis build: 216 --- snippet_data/snippetList.json | 16 ++++++++++++++++ snippet_data/snippets.json | 26 ++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/snippet_data/snippetList.json b/snippet_data/snippetList.json index 0ea50ad11..3a21dd48c 100644 --- a/snippet_data/snippetList.json +++ b/snippet_data/snippetList.json @@ -530,6 +530,22 @@ "hash": "e565a610582386df7a41cbcfcd2d2ad7df11651adceafdd9e4840ca2b756af21" } }, + { + "id": "useComponentDidMount", + "type": "snippetListing", + "title": "useComponentDidMount", + "attributes": { + "text": "A hook that executes a callback immediately after a component is mounted.\n\n- Use `React.useEffect()` with an empty array as the second argument to execute the provided callback only once when the component is mounted.\n\n", + "tags": [ + "hooks", + "effect", + "beginner" + ] + }, + "meta": { + "hash": "82ef558fad661a522f5e897014b3898ad56ab6603a342c477f09edaa6281a0c9" + } + }, { "id": "useFetch", "type": "snippetListing", diff --git a/snippet_data/snippets.json b/snippet_data/snippets.json index 6e2c88b4c..a82bef027 100644 --- a/snippet_data/snippets.json +++ b/snippet_data/snippets.json @@ -850,6 +850,32 @@ "authorCount": 2 } }, + { + "id": "useComponentDidMount", + "title": "useComponentDidMount", + "type": "snippet", + "attributes": { + "fileName": "useComponentDidMount.md", + "text": "A hook that executes a callback immediately after a component is mounted.\n\n- Use `React.useEffect()` with an empty array as the second argument to execute the provided callback only once when the component is mounted.\n\n", + "codeBlocks": { + "style": "", + "code": "const useComponentDidMount = onMountHandler => {\n React.useEffect(() => {\n onMountHandler()\n }, []);\n}", + "example": "const Mounter = () => {\n useComponentDidMount(() => console.log('Component did mount'));\n\n return
Check the console!
;\n}\n\nReactDOM.render(, document.getElementById('root'));" + }, + "tags": [ + "hooks", + "effect", + "beginner" + ] + }, + "meta": { + "hash": "82ef558fad661a522f5e897014b3898ad56ab6603a342c477f09edaa6281a0c9", + "firstSeen": "1578059814", + "lastUpdated": "1578059814", + "updateCount": 2, + "authorCount": 2 + } + }, { "id": "useFetch", "title": "useFetch",