Skip to content

Commit

Permalink
docs(useDefault): Suggest useMediatedState instead (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasNel authored Apr 25, 2022
1 parent 9f8c615 commit af5de33
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/__docs__/migrating-from-react-use.story.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,18 @@ No plans to implement

#### useDefault

Not implemented yet
No plans to implement, rather use [useMediatedState](/docs/state-useMediatedState--example) like
so:

```javascript
const initialValue = 'world';
const defaultValue = 'you';
const [greeting, setGreeting] = useMediatedState(
initialValue,
(newValue) => newValue ?? defaultValue
);
console.log(`Hello ${greeting}`);
```
#### useGetSet
Expand Down

0 comments on commit af5de33

Please sign in to comment.