javascript - Couldn't find a 'component' or 'children' prop for the screen 'Home'. This can happen if you passed 'undefined'. Error with react-navigate v5? - TagMerge
2Couldn't find a 'component' or 'children' prop for the screen 'Home'. This can happen if you passed 'undefined'. Error with react-navigate v5?Couldn't find a 'component' or 'children' prop for the screen 'Home'. This can happen if you passed 'undefined'. Error with react-navigate v5?

Couldn't find a 'component' or 'children' prop for the screen 'Home'. This can happen if you passed 'undefined'. Error with react-navigate v5?

Asked 11 months ago
59
2 answers

This is happening because of the way you export and import HomeScreen.

If you export default you need to import the entire file. Your fix would be to change the import in the Navigator.js from:

import {HomeScreen} from '../' to import HomeScreen from '../'


A time you would use the destructuring import is with a workflow like so:

modules.export = {
    a: apple
    b: banana

}

----

import { a, b } from './fruits.jsx'

Source: link

2

this is a problem with the export 

this error occurs when you define the components with default 
like this:-

    import Home from "./Home";
    import Room from "./Room";
    import Hall from "./Hall";
    
    export default{Home, Room, Hall};

so you have to define without it like this:-

    import Home from "./Home";
    import Room from "./Room";
    import Hall from "./Hall";
    
    export{Home, Room, Hall};

Source: link

Recent Questions on javascript

    Programming Languages