I am fairly new to react and was wondering how I would change the code below in order for me to use onClick function for each of the section tag.
render(){
return(
<div className='App'>
< Header />
<div className="secHeader"><h2>General Education Core</h2></div>
<br/>
{/* Displays the 6 different gen eds cateogry that uic offers and calls the displaygenEdCourse component and sends props to know which item was clicked */}
<div className="box alt container">
{/* link for Analyzing the Natural World */}
<section className="feature left">
<Link to={{pathname: "/displayGenEdCourses", state: { linkState: 'ANW' }}} className="image icon solid fa-seedling"><img src={pic01} alt="pic01" /></Link>
<div className="content">
<h3>Analyzing the Natural World</h3>
</div>
</section>
{/* link for Understanding the Individual and Society */}
<section className="feature right">
<Link to={{pathname: "/displayGenEdCourses", state: { linkState: 'UIS' }}} className="image icon solid fa-users"><img src={pic01} alt="pic01" /></Link>
<div className="content">
<h3>Understanding the Individual and Society</h3>
</div>
</section>
{/* link for Understanding the Past */}
<section className="feature left">
<Link to={{pathname: "/displayGenEdCourses", state: { linkState: 'UP' }}} className="image icon solid fa-history"><img src={pic01} alt="pic01" /></Link>
<div className="content">
<h3>Understanding the Past</h3>
</div>
</section>
{/* link for Understanding the Creative Arts */}
<section className="feature right">
<Link to={{pathname: "/displayGenEdCourses", state: { linkState: 'UCA' }}} className="image icon solid fa-palette"><img src={pic01} alt="pic01" /></Link>
<div className="content">
<h3>Understanding the Creative Arts</h3>
</div>
</section>
{/* link for Exploring World Cultures */}
<section className="feature left">
<Link to={{pathname: "/displayGenEdCourses", state: { linkState: 'EWC' }}} className="image icon solid fa-globe"><img src={pic01} alt="pic01" /></Link>
<div className="content">
<h3>Exploring World Cultures</h3>
</div>
</section>
{/* link for Understanding U.S. Society */}
<section className="feature right">
<Link to={{pathname: "/displayGenEdCourses", state: { linkState: 'UUS' }}} className="image icon solid fa-flag-usa"><img src={pic01} alt="pic01" /></Link>
<div className="content">
<h3>Understanding U.S. Society</h3>
</div>
</section>
</div>
< Footer />
</div>
)
}
Each section tag is a block/image that I want to be able to click and when I click it then it should call onClick function so I get notify which section is clicked. I tried putting onClick inside the section tag like <section className="feature left" onClick={console.log('testing')}>. Also tried playing around and placing the onClick in other places in each section tag but it didn't seem to work. Whenever the page renders, the onClick gets called and then when I click that image it doesn't call onClick. Not sure where I may be going wrong.