Approach question - Passing events to header
See original GitHub issueHi,
I’ve downloaded the kit and altered my app.js to include a site header, I want to have a mini basket in the header and want to pass an “AddToCart” event from a child page into the header.
App.js now looks like this
` render() {
return !this.props.error ? (
<div>
<Header data={this.state.navData} isShopPage={this.state.isShopPage} />
{this.props.children}
<Footer />
</div>
) : this.props.children;
}`
I’ve been using the kit to get to grips with react so this may be a newbie question but can someone explain the best way to wire up and pass an event from a child route back up into the app and over to the header component?
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
HTTP Authorization Header in EventSource (Server Sent ...
I need to set an Authorization header to an HTML5 EventSource. As Server Sent Events seems to be disused since Websockets appeared, I...
Read more >HTTP/1.1: Header Field Definitions
If an Accept-Language header is present, then all languages which are assigned a quality factor greater than 0 are acceptable. It might be...
Read more >Lambda@Edge event structure - Amazon CloudFront
The following topics describe the request and response event objects that CloudFront passes to a Lambda@Edge function when it's triggered.
Read more >XMLHttpRequest.setRequestHeader() - Web APIs | MDN
The XMLHttpRequest method setRequestHeader() sets the value of an HTTP request header. When using setRequestHeader() , you must call it ...
Read more >Twilio Function Execution
If your Function Code does not contain a handler method, Twilio Functions will ... The event object contains the request parameters and headers...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same with me, and I’ve tried something like this
so, i just need to add props in children’s index.js (in routes directory)
still looking the best way to do this.
@pcooper1979 thank you very much for crating this issue! Unfortunately, we have close it due to inactivity. Feel free to re-open it or join our Discord channel for discussion.
NOTE: The
main
branch has been updated with React Starter Kit v2, using JAM-style architecture.