N
N
Nurislam Nagashybai2022-04-12 19:31:15
JavaScript
Nurislam Nagashybai, 2022-04-12 19:31:15

How to fix module error in NextJs-App?

I want to import the Htag module from the Components folder to index.tsx, but on the page it says that the module was not found, although everything is correct in the IDE

Htag.tsx

import {HtagProps} from "./Htag.props";


export const Htag = ({tag, children}:HtagProps):JSX.Element => {
    return(<h1>{children}</h1>);
}


HtagProps.tsx
import {ReactNode} from "react";


export interface HtagProps {
    tag: 'h1' | 'h2' | 'h3';
    children:ReactNode;
}


Index.ts
export * from './Htag/Htag';

Index.tsx
import React from "react";
import {Htag} from "../Components";

export default function Home(): JSX.Element {
  return (
      <div>
        <Htag tag={'h1'}>Text</Htag>
      </div>
  );
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question