react中的逆向傳輸流

在react中提供的props只能進行單向傳輸流,可是在某些狀況下,咱們必需要從子組件發送信息到父組件,所以,咱們能夠在子組件中經過props函數來回調給父組件達到修改父組件state中的數據,從而達到逆向傳輸流。 舉個栗子~~~ class DemoOne extends React.Component { handleVote(productId) { const ne
相關文章
相關標籤/搜索