Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
190 views
in Technique[技术] by (71.8m points)

How to pass value to the variable on click in Reactjs

I beginner to React in react how to pass the value to variable from one component to another component with on click function on col the example code below

Home component:

1st column 
<Col ClassName="Hello">
   <p>Hello</p>
</Col>

2nd column 
<Col ClassName="Hi">
   <p>hi</p>
</Col>

second component: contains variable

const word= onclick value

when we click Hello column Hello should be passed to the variable word in second component likewise when we click Hi column Hi should be passed to the variable word


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...