Skip to content

Commit

Permalink
Changes variable declarations in code examples (reactjs#2345)
Browse files Browse the repository at this point in the history
Converts a few `let` declarations for constant values to `const` in code examples
  • Loading branch information
anthonyvalera authored and lex111 committed Jan 2, 2020
1 parent 6788666 commit fc0e690
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions content/docs/hooks-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
});
Expand Down

0 comments on commit fc0e690

Please sign in to comment.