this.history is undefined with injectHistory
See original GitHub issueResources: https://stenciljs.com/docs/router-tutorials#inject-history-into-a-deep-component
Stencil version::
@stencil/core@0.15.2
I’m submitting a … [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com
Current behavior: this.history is undefined in a deep component
Expected behavior: this.history is not undefined
Steps to reproduce: All steps from https://stenciljs.com/docs/router-tutorials#inject-history-into-a-deep-component
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:10
Top Results From Across the Web
this.history is undefined with injectHistory · Issue #79 · stencil ...
Tried to debug this issue and found that function that creates Provider is copied in bundle 2 times, hence we have two copies...
Read more >javascript - How to pass 'history' object to stencil.js component ...
However I'm completely unable to injectHistory(Appnav) to the component, according to some tuorials I followed. Always I get an undefined log. Structure as ......
Read more >React router v5 - TypeError history is undefined
Unfortunately, I was receiving TypeError: history is undefined every button was pressed. It took me a while, but the fix was trivial.
Read more >React Router - How to pass History object to a component
Do you mind explaining why this.props.history.push("/home") might result in undefined but this would work? I think it has something to do with ...
Read more >React Router, why useLocation and useHistory might return ...
const history = useHistory() const location = useLocation(). They both returned undefined . Turns out I was adding the Router to the DOM ......
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
I could not reproduce the issue on my side with stencil-router 1.0.1.
I needed to navigate programmatically in some component of my application which is not rendered by a
stencil-route
and followed this wiki article. To have thehistory()
property defined, you need to additionally inject the history, the wiki article was not complete here.So my full components looks like this now:
Still not working