useBreakpoint value names are hard to comprehend #371
Replies: 6 comments
-
I think I like Device names would need a separate function exported for I also find idea of ergonomic breakpoint variables interesting. |
Beta Was this translation helpful? Give feedback.
-
i wouldn’t recommend (or even consider) patching tailwind to use a different system, and i understand “md” etc were probably trying to match tailwind, but it’s two different contexts IMO
|
Beta Was this translation helpful? Give feedback.
-
i really like the “ergonomic” names!
…--- original message ---
On January 11, 2021, 09:43 PST [email protected] wrote:
--- end of original message ---
|
Beta Was this translation helpful? Give feedback.
-
Related PR: #307 |
Beta Was this translation helpful? Give feedback.
-
We are talking about the same context imo, because we use these "js-defined" (formerly |
Beta Was this translation helpful? Give feedback.
-
Demo of how this approach works: https://share.getcloudapp.com/NQuKyD0r usage:
|
Beta Was this translation helpful? Give feedback.
-
These are confusing when in encountered in JSX and we should consider using verbose longform variable names that fully describe what it is/does.
https://github.com/eggheadio/egghead-next/blob/9536ccb34ba3a080f6c703c7fc9f440587b9499b/src/utils/breakpoints.ts#L13-L21
This longer form we are exporting are much easier to comprehend, so something similar for this purpose would be very appreciated.
The names should express what the value does.
Additionally this utility is prefixed with
use
and is not a React Hook.use*
should only be applied to React Hooks.For "custom hooks" this typically means the custom hook will call one of the built-in hooks like
React.useState
orReact.useEffect
and not simply provide a return value in the style of a React hook.This utility could use some documentation as well.
Discussion welcome!
Beta Was this translation helpful? Give feedback.
All reactions