-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add hooks to events #6
base: master
Are you sure you want to change the base?
Conversation
onStatusChange = noop, | ||
onOnline = noop, | ||
onOffline = noop | ||
}) { |
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 change would make the param optional
Not sure bringing a UI library in is a good idea, I would say these hooks should remain as small as possible to allow people consuming them to decide how they want to. ie, if I'm not using evergreen, or don't like the look of these popups .. I can't really use this hook |
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.
alternatively you could create a hook and open source it under your own name with this functionality.
I would say bringing in evergreen ui might be out of scope for these hooks
thoughts @jamiebuilds @fouad ? |
Yeah I agree I added that while developing. Need opinions on showing how to
use the hooks
…On Fri, 26 Oct 2018 at 23.41 Jack Hanford ***@***.***> wrote:
***@***.**** requested changes on this pull request.
alternatively you could create a hook and open source it under your own
name with this functionality.
I would say bringing in evergreen ui might be out of scope for these hooks
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADkzMk6cuil2h4BgTN6kFlgpbbkaqiYiks5uoztLgaJpZM4X77yV>
.
|
Yeah, no need for UI, it's only going to make things more confusing |
Definitely no UI 😛 |
package.json
Outdated
@@ -28,6 +28,7 @@ | |||
"devDependencies": { | |||
"ava": "^0.25.0", | |||
"browser-env": "^3.2.5", | |||
"evergreen-ui": "^4.2.0", |
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.
Seems a bit overkill to pull in a UI library
|
||
function MyComponent() { | ||
let onlineStatus = useOnlineStatus(); | ||
let onlineStatus = useOnlineStatus({ | ||
onStatusChange: online => |
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 feel like this should be implemented as something like <OnlineToaster status={onlineStatus} />
that triggers a toast on prop change rather than introducing a new concept to Hooks
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 isn't really a new concept for hooks useImperativeMethods
is basically this.
I think it's fine, but I would assume most of the time you'd use it for setX
calls
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.
@fouad I can see the point you are making here. I added those hooks because I sometimes need to call some function whenever the online
status changes. What do you people think? Should this be implemented here or not? 🙏
Just re-read the messages. I think @hanford mistook me for adding a UI lib for the main bundle. I didn't, and just used the |
This is giving the users more flexibility so they can pass their own hooks to the |
I've removed the ui dependency and opt for a |
online
eventoffline
eventonline
andoffline
event