Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more verbose example for pushEvent & fix type #174

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

kyorkston
Copy link
Contributor

REOPENING
In https://refract.js.org/usage/pushing-to-props#stateful-apertures it says that the useEvent creates the tuple of pushEvent and fromEvent, the example was pushEvent creating the tuple. It was making me doubt myself 馃

Made new type for PushEvent so it is clear there it can take params

Also added a more verbose use on how to use pushEvent as a prop on the component

@kyorkston kyorkston requested a review from troch as a code owner March 26, 2021 11:58
@yueliangwen
Copy link

Is there any progress?

Copy link
Collaborator

@thisRaptori thisRaptori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay - moved house recently and the notif for this got lost under an avalanche of emails!

Thanks for fixing this, looks good but I've got one question/suggestion:

Comment on lines +11 to +13
export type PushEvent<T = unknown> = (eventName: string) => PushEventData<T>

export type PushEventData<T = unknown> = (val?: T) => void
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we could add a descriptive name for the type T? Makes it a lot easier to follow imo! 馃槅

@idfunctor
Copy link

idfunctor commented May 24, 2021

@kyrokstan thanks for this, it was confusing for me at first and I assumed pushEvent doesn't take any params at all, until I clicked through the source and realised it will if I pass it a type. Also, before that, it took me like 15 mins to realise the docs were incorrect and useEvent was what I was looking for. This will really help people trying this lib out for the first time.

@idfunctor
Copy link

@thisRaptori Appreciate you not abandoning this project. Do you think it's a good idea for me to submit a PR for upgrading to @most/core instead of most? I'm using Rx right now but the project is still pre-MVP and I'd love to try switching over from Rx.

@thisRaptori
Copy link
Collaborator

Yeah that'd be great! I'd need to figure out how the publish scripts work unless @troch would be around to handle the publishing, but that shouldn't be an issue 馃槃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants