Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Gets undefined when i pass a title as props

when i’m trying to pass the title like this

 BookShelf shelfBooks={wantReadShelf} ShelfTitle="Want To Read"  handelChange={handelChange}/>

then recive it her

const BookShelf =({shelfBooks,ShelfTitle,handelChange})=>{


    return (
        <div className="bookshelf">
                <h2 className="bookshelf-title" value={ShelfTitle}>{ShelfTitle} shelfTitle</h2>

however ‘shelfBooks’ is passed succssefully

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try using shelfTitle in lowercase instead like

const BookShelf =({shelfBooks,shelfTitle,handelChange})=>{


    return (
        <div className="bookshelf">
                <h2 className="bookshelf-title" value={ShelfTitle}>{shelfTitle} shelfTitle</h2>

This is because React follows the convention of using camelCase for naming props and state variables.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading