Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Difference in push and navigate in react Navigation

The Push action adds a route on top of the stack and navigates forward to it. This differs from navigate in that navigate will pop back to earlier in the stack if a component is already mounted there. Push will always add on top, so a component can be mounted multiple times.

We can take Instagram for example;

Consider navigating to a user's profile. Then you can check user's followers and then you can navigate to their profile's too. If you do this same actions with only navigate action, when you click on an user's profile from the followers list screen will navigate to the previous profile but if you use push it will push a new screen to the stack and show the correct profile. This way you can goBack to the first screen.
Comment

PREVIOUS NEXT
Code Example
Javascript :: repeat an array multiple times in js 
Javascript :: jquery selector parent on hover 
Javascript :: npm run build npm ERR! Missing script: "build" for firebase 
Javascript :: Send Post Fetch REquest With Django 
Javascript :: base64 to image nodejs 
Javascript :: javascript sum of arguments 
Javascript :: leap year function javascript 
Javascript :: react Refused to execute inline script because it violates the following Content Security Policy directive 
Javascript :: react navigation history clear 
Javascript :: is javascript front end or backend 
Javascript :: run a local instance of Kibana on docker and connect to elasticsearch 
Javascript :: jquery datatime 
Javascript :: get only numbers from string 
Javascript :: jquery on scroll 
Javascript :: convert json to table in sql server 
Javascript :: hide column in antd table using js / react with conditional rendering 
Javascript :: regex all 
Javascript :: moment to javascript date 
Javascript :: js change canvas resolution 
Javascript :: warning React Hook useEffect has a missing dependency: 
Javascript :: find my url in nodejs 
Javascript :: merge sort javascript 
Javascript :: get element in javascript 
Javascript :: js encode url 
Javascript :: completely remove duplicate element from the array 
Javascript :: use location hook 
Javascript :: stop() in jquery 
Javascript :: javascript check string lenght 
Javascript :: how to check request method was a get 
Javascript :: react electron boilerplate 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =