Browse Source

[Beta] Update some document content format (#5034)

main
zqran 2 years ago
committed by GitHub
parent
commit
c5b560c7ea
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      beta/src/content/learn/reusing-logic-with-custom-hooks.md

4
beta/src/content/learn/reusing-logic-with-custom-hooks.md

@ -127,7 +127,7 @@ function SaveButton() {
}
```
Although there is no such built-in Hook, you can write it yourself. Declare a function called `useOnlineStatus()` and move all the duplicated code into it from the components you wrote earlier:
Although there is no such built-in Hook, you can write it yourself. Declare a function called `useOnlineStatus` and move all the duplicated code into it from the components you wrote earlier:
```js {2-16}
function useOnlineStatus() {
@ -230,7 +230,7 @@ This convention guarantees that you can always look at a component and know wher
<Note>
If your linter is [configured for React](/learn/editor-setup#linting), it will enforce this naming convention. Scroll up to the sandbox above and rename `useOnlineStatus` to `getOnlineStatus`. Notice that the linter won't allow you to call `useState` or `useEffect` inside of it anymore. Only Hooks and components can call other Hooks!
If your linter is [configured for React,](/learn/editor-setup#linting) it will enforce this naming convention. Scroll up to the sandbox above and rename `useOnlineStatus` to `getOnlineStatus`. Notice that the linter won't allow you to call `useState` or `useEffect` inside of it anymore. Only Hooks and components can call other Hooks!
</Note>

Loading…
Cancel
Save