Set default source value for the image element in react

Hello everyone

i wanted so set default src value for my img element in react

import React from "react";
import blogData from "../data/blog";

function About(props) {
    return (
           <img  src={props.src = ""}  alt="blog logo"/>

export default About

I’ve tried this so far but it gives me this error

TypeError: Cannot add property src, object is not extensible

any tiny help will be appreciated.

You should probably review the following two challenges:

1 Like

Thanks for your response @camperextraordinaire , but i wanted to do it in a function component not class component, I’ve researched on the internet but didnt find how to do it .

Update: Thank you very much, it worked in the same way as the Challenge suggested

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.