-
Notifications
You must be signed in to change notification settings - Fork 39
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
create hook useDevice() #595
base: main
Are you sure you want to change the base?
Conversation
components/section.tsx
Outdated
props: { | ||
req, | ||
get device() { | ||
return device ??= deviceOf(ctx.request); |
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.
its not reusing it from ctx, why?
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.
I understand the rational behind this change and I know that is sucks to create an inline loader just to access device 90% of the times that you need a loader. However I think this is beneficial for many reasons, I will try to list some of them here but this is not exhaustive, just few of them that I'm thinking right now:
- It is less react-compatible component
Meaning that reusability becomes difficult, you can't export this section as an Island, for instance, because it now receives request and for the most of cases request is not available to be used, same for device.
-
Component props now can receive request and device, which would need us to create extra features to hide/ignore them when generating schema.
-
users can do it by themself in userland using an app middleware, we can improve the ux for doing it to be a brainless operation
-
A better alternative more react-compatible can be using hooks? I know there are scenarios where hooks won't work like inside islands that runs client-side, but well our users is facing these problems today
I followed Candeia instructions and created a Hook. |
No description provided.