From fc0e690b4e6996da5d730aa0cc4adf3b9950c475 Mon Sep 17 00:00:00 2001 From: Anthony Valera Date: Thu, 2 Jan 2020 14:53:52 -0800 Subject: [PATCH] Changes variable declarations in code examples (#2345) Converts a few `let` declarations for constant values to `const` in code examples --- content/docs/hooks-faq.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/docs/hooks-faq.md b/content/docs/hooks-faq.md index 59515925..85e27b22 100644 --- a/content/docs/hooks-faq.md +++ b/content/docs/hooks-faq.md @@ -428,8 +428,8 @@ Here, we store the previous value of the `row` prop in a state variable so that ```js function ScrollView({row}) { - let [isScrollingDown, setIsScrollingDown] = useState(false); - let [prevRow, setPrevRow] = useState(null); + const [isScrollingDown, setIsScrollingDown] = useState(false); + const [prevRow, setPrevRow] = useState(null); if (row !== prevRow) { // Row changed since last render. Update isScrollingDown. @@ -718,7 +718,7 @@ As a last resort, if you want something like `this` in a class, you can [use a r ```js{2-6,10-11,16} function Example(props) { // Keep latest props in a ref. - let latestProps = useRef(props); + const latestProps = useRef(props); useEffect(() => { latestProps.current = props; });