I am developing a web application using React + Node.js for my college project.
However, I am facing significant difficulties in importing the main layout to another route (cadastro/produtos).
When accessing this route that I mentioned above, it appears like this (without the layout configurations that I have already saved in the Components folder).
I need help… can anyone assist me?
enter image description here
enter image description here
import { Layout } from '../../'
export const CadastroProdutos: React.FC = () => {
return(
<Layout titulo="Cadastro de produtos">
</Layout>
)
}
I believe the issue is here, I think the import is not being done correctly in this code.
2
Answers
Based on your code snippet and assuming your Layout component is located directly inside the Components folder, the correct import statement should be:
Make sure the path and filename casing are correct. This should resolve the issue with importing the Layout component into your CadastroProdutos component.
It looks like there might be an issue with your import statement. When importing components in React, you need to specify the exact file path where the component is located. Based on the code you provided, it seems like you’re trying to import the Layout component from a file or folder named "../../".
Assuming that your Layout component is located in a file named Layout.js or Layout.tsx inside a folder named Components, you should adjust your import statement like this: