Tallia
Tallia

Reputation: 144

How to click a button on a different page in React Native?

If I'm on page 2 and I want to click a button on Homepage, how do I do it?

In Javascript, we can just do query selector and DOM manipulation but that functionality doesn't exist in React Native

Upvotes: 0

Views: 49

Answers (1)

Rishav Kumar
Rishav Kumar

Reputation: 5450

You can achieve this by sending and receiving events.

Using event bus you can fire some events from screen A and receive/catch those events in screen B. While you receive those events, perform the functionality which you want.

This is the least code correct implementation which you need.

Also, please dont remove the event in componentDidUnmount

Upvotes: 1

Related Questions