-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
Hello, I'm a freshman in React.
I got this message, but I cannot help avoiding this:
Warning: Unknown props `match`, `location`, `history`, `staticContext` on <div> tag. Remove these props from the element. For details, see https://fb.me/react-unknown-prop
My app is working even with this warnings, but I don't wanna clean up console msgs.
This is my use case:
import { Router, withRouter } from 'react-router-dom';
import { Box, VBox, Container } from 'react-layout-components';
const RoutedVBox = withRouter(VBox);
...
class MyApp extends React.Component {
render() {
return (
<Router>
<RoutedVBox> ... </RoutedVBox>
</Router>
)
}
}
I tried to removing props of Router(match, location, history, staticContext) by this function, but It breaks successful works.
const MyBox = props => {
const { match, location, history, staticContext, ...restProps } = props;
return (<Box {...restProps} />);
}
I just want to remove warning message in console, is there a way for this?
There is no answers in SO.
Should I keep going with warnings?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels