D
D
diafree2020-01-28 14:40:28
React
diafree, 2020-01-28 14:40:28

How to solve module not found in React component?

Good afternoon.
There are two components. They are located in ./src/components/
When I try to import another into one of the components, I get the module not found

error . it looks like this:

Component1

import React, { Component } from 'react';

class Component1 extends Component {
  render() {
    return (
      'Component1'
    )
  }
}

export default Component1;


Component2
import Component1 from 'Component1';

class Component2 extends Component1 {

  render() {
    return (
      'Component2'
    )
  }
}

export default Component2;


Tell me how to solve the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2020-01-28
@diafree

import Component1 from './Component1';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question