Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

How to raise event to parent manually? #31

Open
Boscop opened this issue Nov 20, 2018 · 0 comments
Open

How to raise event to parent manually? #31

Boscop opened this issue Nov 20, 2018 · 0 comments

Comments

@Boscop
Copy link

Boscop commented Nov 20, 2018

The component example shows how to forward an event from a child of self to self's parent.
But how can self raise an event to self's parent manually (e.g. in an event handler)?

And how can msgs be dispatched on a child (or how can a component react to one of its props being changed) / how can children be queried about their state?

IOW, how to do these:

raising an event to the parent:
https://github.com/slamdata/purescript-halogen/blob/edc007a584e00471af89102ef0f31cb53047c4a1/examples/basic/src/Button.purs#L51
handling it in the parent:
https://github.com/slamdata/purescript-halogen/blob/edc007a584e00471af89102ef0f31cb53047c4a1/examples/components/src/Container.purs#L65-L67

child querying (for requests with response or just setting child state):
https://github.com/slamdata/purescript-halogen/blob/edc007a584e00471af89102ef0f31cb53047c4a1/examples/components/src/Container.purs#L69
https://github.com/slamdata/purescript-halogen/blob/edc007a584e00471af89102ef0f31cb53047c4a1/examples/components/src/Button.purs#L55-L57
example 2:
https://github.com/slamdata/purescript-halogen/blob/e51eee0afd4f9816a64242f9c4a7b67ffc157e7b/examples/components-multitype/src/Container.purs#L79-L81
https://github.com/slamdata/purescript-halogen/blob/e51eee0afd4f9816a64242f9c4a7b67ffc157e7b/examples/components-multitype/src/ComponentA.purs#L47-L48

reacting to prop changes:
https://github.com/slamdata/purescript-halogen/blob/edc007a584e00471af89102ef0f31cb53047c4a1/examples/components-inputs/src/Display.purs#L24
https://github.com/slamdata/purescript-halogen/blob/edc007a584e00471af89102ef0f31cb53047c4a1/examples/components-inputs/src/Display.purs#L39-L42

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

No branches or pull requests

1 participant