score:-2
in your app.js file when you are importing the components make sure you write then in {}
like below
import {header} from './common/header';
import {homepage} from '../components/home/homepage';
this will resolve the issue.
if you have some default export components that you can mention without {}.
like below
import header from './common/header';
if you have multiple components in one js file, you can write as below
import header,{othercomponent1,othercomponent2} from './common/header';
score:0
anyone else having this problem, ensure you have an export default for any component you use in your route, else you will run into this error.
score:0
for those who encounter this type of issue. do not forget our best friend in javascript!
react has made it clear that you have a problem in the <app />
component, so first try to do console.log(app)
in your index to see what it returns.
then dig down by removing components 1 by 1 in the <app />
to see which one causes the trouble.
score:1
for me it seemed like i had to remove the memoryrouter
or connectedrouter
in your case.
also, note that my issue was in my app.test.js
file so it may not apply to op's specific use case but it might help those of you whom arrived here through google.
can someone please explain why this works?
this is the code that is now working:
<provider store={store}>
<app />
</provider>
this is the original non-working code:
<provider store={store}>
<connectedrouter history={history}>
<app />
</connectedrouter>
</provider>
Source: stackoverflow.com
Related Query
- Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- Reactjs Warning: input is a void element tag and must not have `children` or use `props.dangerouslySetInnerHTML`. Check the render method of null
- React Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `App`
- Check the render method of `App`
- Check the render method
- Required context `router` was not specified. Check the render method of `RoutingContext`
- Warning: Failed propType: Required prop `dimensionName` was not specified in `DimensionPicker`. Check the render method of `Connect(DimensionPicker)`
- Check the render method of `ConnectedField`
- Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `SocialMenu`. (React.js in a Meteor.js app)
- Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `Units`
- React with Redux Warning: Failed propType: Required prop `posts` was not specified in `Posts`. Check the render method of `PostsContainer`
- Invariant Violation: Element type is invalid: expected a string or a class but got: undefined. Check the render method of `MyApp`
- Check the render method of 'PodCastScreen' React Native
- Check the render method of ForwardRef
- ReactJs Element type is invalid Check the render method
- Each child in a list should have a unique "key" prop. Check the render method of `Form`
- React native error of Check the render method of App
- Element type is invalid: expected a string (for built-in components) Check the render method of `UploadProduct`
- ReactJS keep asking for key: Warning: Each child in a list should have a unique "key" prop. Check the render method of `PostCard`
- Check the render method of `component`
- Each child in an array or iterator should have a unique "key" prop. Check the render method of `Abstractfactory`
- Invariant Violation: Objects are not valid as a React child. Check the render method of `Content`
- Warning: Failed propType: Required prop `data` was not specified in `Photo`. Check the render method of `withApollo(Photo)`
- Warning: Failed propType: Required prop `children` was not specified in `Pane`. Check the render method of `first-time-tab`
- React Component Function with Each child in a list should have a unique "key" prop. Check the render method
- Check the render method of `InputOption`
- Warning: Each child in a list should have a unique "key" prop. Check the render method of `Body`. yet i already have key
- I can't resolve this error : Check the render method of `App`
- Tab Error in React : Check the render method of TabPanel
- Jest Test - unique "key" prop error. Check the render method of xyz
More Query from same tag
- Reactjs error on return component
- read json from local file returned html?
- How can I change state of another reducer from extra reducers add cases
- Two Components Connected to Each-other
- State not updating until 2nd time the form is submitted
- How to get failed or popup close event of razorpay
- Using ReactJS with Jinja2 and Webapp2
- How to loop through an array with keys and values in to send a request for Axios.get's params in ReactJS?
- react-hook-form: Validation not working when using onBlur mode
- NPM - How to use local component file as package
- Why redux diff says that states are equal even though ther are not
- How to apply styling to expandIcon in MUI Accordion when Accordion is in expanded state?
- Differences between Tab, TabContext, Tablist, TabPanel, in React material-ui
- how to import Helper class in react
- Material UI Pickers - Jalali Calendar Issue
- Firebase firstore auto increment number not working (React js)
- Material-UI Slider with discreet values only?
- React problem with router before fetching the user
- How to display product info from an array in react?
- Execute Vanilla JS Scripts in React after DOM Render
- Work with multiple checkboxes in the edit form in React and react-bootstrap
- Redux store doesn't get updated synchronously?
- Error while creating an action: Action must be plain object
- ForwardRef warning React-hook-forms with Material UI TextField
- Is it possible update Highchart data automatically and make animated effect?
- How to getById in redux
- How to set state from multiple Select components in one method
- Fetching values from this.props.children
- how to change color of Backbutton Arrow in react native router flux?
- Redirecting doesn't render the component but changes url in address bar