发出从一个类发送值到另一个类的响应

时间:2018-05-21 12:45:45

标签: javascript reactjs npm render

这里我将index.js中的值列表为

SELECT u.id AS User,
  p1.PLAYER_NAME AS Player1,
  p2.PLAYER_NAME AS Player2,
  p3.PLAYER_NAME AS Player3,
  p4.PLAYER_NAME AS Player4,
  p5.PLAYER_NAME AS Player5,
  p6.PLAYER_NAME AS Player6,
  p7.PLAYER_NAME AS Player7,
  p8.PLAYER_NAME AS Player8,
  p9.PLAYER_NAME AS Player9,
  p10.PLAYER_NAME AS Player10,
  p11.PLAYER_NAME AS Player11,
  p1.POINTS + p2.POINTS + p3.POINTS + p4.POINTS + p5.POINTS + p6.POINTS + p7.POINTS + p8.POINTS + p9.POINTS + p10.POINTS + p11.POINTS AS Total
FROM USERS u
JOIN Player_details p1 ON p1.ID = u.player1
JOIN Player_details p2 ON p2.ID = u.player2
JOIN Player_details p3 ON p3.ID = u.player3
JOIN Player_details p4 ON p4.ID = u.player4
JOIN Player_details p5 ON p5.ID = u.player5
JOIN Player_details p6 ON p6.ID = u.player6
JOIN Player_details p7 ON p7.ID = u.player7
JOIN Player_details p8 ON p8.ID = u.player8
JOIN Player_details p9 ON p9.ID = u.player9
JOIN Player_details p10 ON p10.ID = u.player10
JOIN Player_details p11 ON p11.ID = u.player11

如果我点击提到的div标签,我应该能够使用id值渲染到详细信息页面。我应该能够将id值附加到details.js

中提到的其他url

请帮我找到解决方案

1 个答案:

答案 0 :(得分:0)

您应该检查使用react-router实现您的方案的page

您的案例可以<Link to="/one">1</Link>,定义的<Route path="/one" component={One} />,其中One是当网址为&#39; / one&#39;

时将呈现的组件

在路由器中定义后,您可以在网址中附加页码 <Route path="/one/:pageNumber" component={One} />

在详细页面组件中,您可以使用对象

读取值
this.props.match.params.pageNumber