Saad Arshad
Saad Arshad

Reputation: 48

How to pass data between same level classes/component without using Navigation in React Native?

Pass data from one class to another class that resides on the same level without navigating in react native.

Upvotes: 0

Views: 344

Answers (1)

Thomas
Thomas

Reputation: 8013

Passing props or state between two components that are on the same level within your component tree is not possible in React. As a general rule of thumb in React: when two adjacent components need the same data, it is probably better to "lift" the property up a level in your hierarchy and pass the props to both components separately.

Upvotes: 1

Related Questions