ToastContents: "Warning: Unknown props `store`, `intl`, `router`, `history` on <div> tag."
See original GitHub issueMaybe I’m not using the Toast component correctly, but this warning always comes up when the Toast is render. Basically, I have a boolean in my state that tells to render or not the toast inside de App component.
let toast = null;
if(displayToast){
toast = (<Toast status={status} onClose={onClose}>{message} </Toast>)
}
<BrowserRouter>
<App centered={false} inline >
{toast}
<Switch>
<Route exact path="/">
<Redirect to={PATHS.home} />
</Route>
<Route path={PATHS.home} component={HomePage}/>
</Switch>
.....
</App>
</BrowserRouter>
Expected Behavior
The Toast renders without warning.
Actual Behavior
The parent component throws a warning.
URL, screen shot, or Codepen exhibiting the issue
Link in the warning: https://facebook.github.io/react/warnings/unknown-prop.html
Your Environment
- Grommet version: 1.6.0
- Browser Name and version: Chrome
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Team:Estonia TUIT/f50ec03 - iGEM 2020
L:function(){return new c.a.Store(Object.assign({strict:!1},L))};var N={} ... :[Do],props:{aspect:{type:[Number,String],default:"1:1"},tag:{type:String ...
Read more >frequent-classes - CodaLab Worksheets
... 4916 load 4914 div 4905 e 4866 t 4860 alert 4849 i 4844 static 4842 third ... 2709 remove 2707 store 2698...
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
@alansouzati : If I’m reading the code right, the
Toast
component is explicitly extracting these four elements (history
,intl
,router
andstore
) from the context and passing them as props to theToastContents
sub-component, which in turn now passes them on thediv
component (which can’t handle them).Per the comments, that’s a way to carry along the rendering context into the layer. But these four elements should be removed from props and transformed back into a rendering context in
ToastContents
before the rest of the props can be passed down to thediv
.That they are not is the origin of the problem. I’m not sure HOC wrappers are the issue here, since we’re not using any.
@alansouzati : Thank you!