The JSX element 'HeaderPublic' does not contain any construction or calling signatures

I am currently utilizing nx workspace to build the react ts application.

Below is the library component:

import { ReactElement } from 'react';
import styles from './header-public.module.scss';

export function HeaderPublic(): ReactElement {
  return (
    <div className={styles['container']}>
      <h1>Welcome to HeaderPublic!</h1>
    </div>
  );
}

export default HeaderPublic;

And here is the layout component:

import * as HeaderPublic from '@stonehenge/header-public';
import { ReactElement } from 'react';
import layoutStyle from './layout-public.module.scss';

export function LayoutPublic({ children }: { children: ReactElement }) {
  return (
    <section className={layoutStyle['app-wrapper']}>
      <header className="app-header">
        <HeaderPublic></HeaderPublic>//error
      </header>
      <main className="app-main">{children}</main>
      <footer className="app-footer"></footer>
    </section>
  );
}

export default LayoutPublic;

An error occurs in the header component:

JSX element type 'HeaderPublic' does not have any construct or call signatures.ts(2604) 

Although

<main className="app-main">{children}</main>
works fine, the header throws an error. Can anyone provide assistance?

Answer №1

When bringing in the component, I utilized the following method:

import { HeaderPublic } from '@stonehenge/header-public';
, as opposed to

import * as HeaderPublic from '@stonehenge/header-public';
, and it is functioning properly now.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the process for generating an oauthSignature?

I'm interested in using the Twitter API and I need to utilize some GET and POST methods. Fortunately, I have all the necessary keys such as consumer Key, Consumer Secret, Access Token, and Token Secret. However, I am facing an issue with generating oa ...

What is the best way to send multiple parameters to @Directives or @Components in Angular using TypeScript?

I am facing some confusion after creating @Directive as SelectableDirective. Specifically, I am unclear on how to pass multiple values to the custom directive. Despite my extensive search efforts, I have been unable to find a suitable solution using Angula ...

Updating DynamoDB objects seamlessly in Lambda functions without any conflicts

I am currently working with example Objects that follow this interface structure: interface Car{ id: Number; name: String; tires: Wheel[] } interface Wheel{ id: Number; name: String; radius: Number; } My goal is to store these Car Objects in DynamoDB and ...

Navigating in React Native with React Navigation or utilizing the power of React Hooks

When it comes to navigating between screens with React Native, how do the methods differ when using React Navigation compared to using hooks and functions for navigation? And is React Navigation the superior choice? ...

What is the process for retrieving the address of the connected wallet using web3modal?

I've been working on an application using next.js and web3. In order to link the user's wallet to the front-end, I opted for web3modal with the following code: const Home: NextPage = () => { const [signer, setSigner] = useState<JsonRpcSig ...

Encountering Issues with NextJS Dynamic SSR: Mobile Devices stuck on loading screen

Issue: The dynamic import feature of Next JS is encountering loading issues specifically on mobile browsers such as Google Chrome and Safari on IOS. Strangely, the functionality works smoothly on desktop browsers like Google Chrome and Mozilla. The projec ...

What is the standard practice for configuring a React and Express web application?

Currently, I am embarking on a project that involves creating a Single Page Application (SPA) using React, Node, and Express. Initially, I contemplated the idea of utilizing Node/Express to serve static files, including writing a react app and hosting it v ...

Updating the input value in a React application

With a list and an edit button, upon clicking the edit button, a new modal opens. How can I auto-populate the selected username email? The server-side response is {this.test.name}, where I provide him with the input value to auto-populate. However, when ...

Next.js encounters an issue: "The text content does not align with the server-rendered HTML"

I just set up a new Next.js project and added a very basic component: const IdPanel = () => { const [id] = useState(`${Math.random()}`); return ( <div> <h1 id={id} className={id}> {id} </h1> </div> ...

I encountered an issue with the mui TextField component in React where it would lose focus every time I typed a single character, after adding key props to

I'm encountering an issue with a dynamic component that includes a TextField. Whenever I add the key props to the parent div, the TextField loses focus after typing just one character. However, when I remove the key props, everything works as expected ...

The ambiguity surrounding the advantages of using the "setLoading" state in React axios is a topic of discussion

https://i.stack.imgur.com/cytjJ.png Hello there, I'm curious to know about the state loading functionality. Can someone explain what purpose is served by using "setLoading(true)" in axios? Appreciate your help! ...

The TypeScript error message indicates that the property 'forEach' is not found on the 'FileList' type

Users are able to upload multiple files on my platform. After uploading, I need to go through each of these files and execute certain actions. I recently attempted to enhance the functionality of FileList, but TypeScript was not recognizing the forEach m ...

Changing the color gradient of a range column chart in ApexCharts

Currently, I am working on a project where I am trying to incorporate a waterfall chart using ApexCharts. Unfortunately, the Waterfall chart is not readily available with ApexCharts, so I am experimenting with modifying the range column chart into a Waterf ...

Tips for navigating the material ui Expanded attribute within the Expansion Panel

After looking at the image provided through this link: https://i.stack.imgur.com/kvELU.png I was faced with the task of making the expansion panel, specifically when it is active, take up 100% of its current Div space. While setting height: 100% did achi ...

React will perform redirects during development, but they will not work once the app

After encountering some difficulties with domain registration and poor planning, I found myself in a situation where I needed to quickly create a React app that simply redirects to another site upon loading. To achieve this, I developed a component as show ...

Encountering issues while trying to deploy a Next JS 13 application on Google Cloud Platform's

Everything was functioning properly with Next version 12, however upon upgrading to Next 13 I encountered the following error. and current node version: "18.x.x" Next Js version: "13.2.1" Step #2: /app/node_modules/next/dist/build/index ...

Input a new value into the registration field to update it

My current task involves adding a new text field to a React form using a button. I need this new input text field to be able to store data on a register. How can I go about setting this property? Typically, when creating a text field, you would utilize co ...

What is the best way to integrate Material UI with the router in a Next.js application?

Recently, I created a Next.js v13 typescript app using npx create-next-app. After removing all the default css and html, I started incorporating Material UI into my project. However, when I added the CssBaseline, it resulted in numerous errors related to m ...

`What exactly do auth.guard.ts and the AuthenticationService do in Angular 8?`

import { Injectable } from '@angular/core'; import { AuthenticationService } from './_services'; import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; @Injectable({ providedIn: & ...

Is there a way to send a file with React? Or are there similar methods like `npm unload` for Express?

Is there a way to send files using React similar to express' sendFile method? For example, in express, sending an .exe file would prompt a download, a PDF file would be displayed in the browser, and an image file would also be displayed. I'm curi ...