-
Notifications
You must be signed in to change notification settings - Fork 605
docs: add api guidelines doc #5805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
size-limit report 📦
|
Couple of ideas:
|
#### Controllable props | ||
|
||
- Works with and without props being passed | ||
- There should be a `value` and `onChange` or `onValueChange` prop when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have these in SelectPanel
and we can't use the useControllableState
hook and make them optional because the format is non-standard (extra arguments on the functions). It might be good to be a bit more specific to avoid this in the future :)
- Should they always have a default value? (Maybe the one we expect to be most | ||
used?) | ||
|
||
#### `useCallback` and `useMemo` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't be really that necessary unless we have some very specific needs after the React Compiler, so maybe we can skip it?
- Use `flushSync()` | ||
- Use custom hook for this (`useFocus`) | ||
|
||
### When to provide default props |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I'd like for us to talk about prop spread: it gets really convoluted and hard to know what we actually surface. SelectPanel is a good example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point 👍
No description provided.