Function in a react component


Function in a react component



I'm trying to learn React so forgive me if this question belies some ignorance...but I'll try to keep things simple. I have a component in my react app called "Starset0"



This is it:


import React from "react";

const Starset0 = props => (











);

export default Starset0;



Although what I'm trying to do is more complicated, let's start simple: How would I write a function that would cause the src of any image (star) clicked to change to


{require('./full-star.png')}



?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages