0

Hi I am new to react I am trying added new component called Test and try to use it the app.js imported test into app.js but still get error. Below you can find stackblitz url Thanks in Advance.

Stackblitz url

1
  • Have you tried to change path to this: ./components/test? Commented Sep 9, 2020 at 12:25

3 Answers 3

4

import Test from './components/test'

Implement this line, make sure that c is written in lowercase in component/... path OR just copy the line above and replace yours with it. That will work for sure.

Sign up to request clarification or add additional context in comments.

Comments

0

Issue in your sandbox is Components whereas your folder name is components:

import Test from  './Components';

and you need to complete file path if your not using index.js as reference i.e


import Test from  './components/Test';

Here is demo: https://stackblitz.com/edit/react-vcw5a8?file=src%2FApp.js

Comments

0

Two ways to go here: Either you import the File directly like this:

import Test from  './components/Test';

or you create a index.jswithin the Components-Folder and add this:

import Test from './test.jsx';

export default Test;

Also, your Import-Statments are Upper-Case whereas you folder-name is lowercase, so you'll have to adjust on or the other.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.