Skip to content

Svg images as props #11794

@Alfrex92

Description

@Alfrex92

Hi, I've got a question how can I send SVG images as props?

If I do this I can display the image without any problem.


import ihtml from '../images/html5.svg'

const Skill = () => (
        <div>
            <img src={ihtml} alt=""/>
        </div>  
)

But I can't display an image as a prop like this :

import ihtml from '../images/html5.svg'

const Skill = (props) => (
    <div>
            {
                props.skillNames.map((skillName, index) => {
                    return (
                        <div key={shortid.generate()}>
                            // the value of skillName.icon is ihtml
                            <img src={skillName.icon} alt=""/>
                        </div>
                    )
                })
            }
    </div>
           
)

Any idea of how can I display images as props?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions