skip to Main Content

I am new at React.js and typescript. I tried googling for this issue but could not find any solution for this.

Sidebar.tsx

...

import Header from "./Header";

const Sidebar = (props: any) => {
    return (
        <aside className="sidebar">
            <Header title={props.pageTitle} />

            ...
        </aside>
    );
};

export default Sidebar;

Header.tsx

const Header = (props: any) => {
    return (
        <header className="header">
            <img src={ props.image } alt="Logo image" />
        </header>
    );
};

export default Header;

How can I fix this issue..?

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    Here is fixed code.

    ...
    
    import Header from "./PageHeader";
    
    const Sidebar = (props: any) => {
        return (
            <aside className="sidebar">
                <PageHeader title={props.pageTitle} />
    
                ...
            </aside>
        );
    };
    
    export default Sidebar;
    

    PageHeader.tsx

    const PageHeader = (props: any) => {
        return (
            <header className="header">
                <h3 className="heading">{ props.title }</h3>
    
                ...
            </header>
        )
    };
    
    export default PageHeader;
    

  2. It is telling you the does not have the attribute title.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search