简体   繁体   中英

ReactJS communication between sibling components

I want to communicate with one of the sibling components and pass props to other component. This has to be done using router concept.

Or else suggest me if any other way to pass an array to other sibling component please let me know.

我认为您真正想做的是从父组件传递一个函数作为props,以更改状态,然后父级将其传递给其子级。

In React data flows from parents to children via what is referred to as 'props'.

A parent child structure is when you add a component under another component like so:

<Parent>
  <Child />
</Parent>

You can then access the parent's data on the child element using this.props.'prop-name'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM