2023-01-27 02:44:01 +00:00
|
|
|
# Parent Child Example
|
|
|
|
|
|
|
|
This example highlights four different ways that child components can communicate with their parent:
|
|
|
|
|
2023-01-29 02:52:16 +00:00
|
|
|
1. `<ButtonA/>`: passing a WriteSignal as one of the child component props,
|
2023-01-27 02:44:01 +00:00
|
|
|
for the child component to write into and the parent to read
|
2023-01-29 02:52:16 +00:00
|
|
|
2. `<ButtonB/>`: passing a closure as one of the child component props, for
|
2023-01-27 02:44:01 +00:00
|
|
|
the child component to call
|
2023-01-29 02:52:16 +00:00
|
|
|
3. `<ButtonC/>`: adding a simple event listener on the child component itself
|
|
|
|
4. `<ButtonD/>`: providing a context that is used in the component (rather than prop drilling)
|
2023-01-27 02:44:01 +00:00
|
|
|
|
2023-09-13 23:57:50 +00:00
|
|
|
## Getting Started
|
2023-01-27 02:44:01 +00:00
|
|
|
|
2023-09-13 23:57:50 +00:00
|
|
|
See the [Examples README](../README.md) for setup and run instructions.
|
2023-11-28 16:47:56 +00:00
|
|
|
|
|
|
|
## Quick Start
|
|
|
|
|
|
|
|
Run `trunk serve --open` to run this example.
|