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

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

iOS Top Alignment constraint based on screen (superview) height