A_L*_*A_L 3 javascript reactjs react-router
我使用下面的路线只是因为它是我在网上找到的代码:
<Route exact path="/test" render={(props) => <Test {...props} msg={ "abc" } /> } />
Run Code Online (Sandbox Code Playgroud)
我知道 {...props} 表示多个参数,但我不明白为什么我需要它,因为下面的代码也工作得很好,并且 props.msg 在测试中可用
<Route exact path="/test" render={() => <Test msg={ "abc" } /> } />
Run Code Online (Sandbox Code Playgroud)
那么 {...props} 在渲染过程中传入时实际上做了什么?
| 归档时间: |
|
| 查看次数: |
358 次 |
| 最近记录: |