0

I'm completelly newbie on react and react-native. So i ask to forgive me for possibly stupid question.

I use redux with react-native-router-flux.

First of all, let me describe the behavior what I want.

I have a scene that shows some info about video. The data is fetching from http page. The video have links to another videos - something like "related videos". On the related video link clicked I need to open new similar scene but vith info of this new video. This vide have relateds too and so on.

So that's what I trying.

A have one scene with key=film. It renders all the info about video. The info fetchs from remote server. On fething it uses this.props.key to identificate the video page. On related video click I called Action.film({key: NEW_VIDEO_KEY}) and new scene opens, takes new data from fetch and shows new video info. And so on. I do this 5 times for example. So 6 scenes was opened (with the first one). But after pressing the BACK button all previous scenes shows the same info as the last one. I think, it's because of react-router-flux does not remember scenes data but only the route. Each opened scene was modified props, so after the last scene it hase the last props.

I don't understand how to implement needed behavior as I describe at the beginning.

May be I need to add something like history object to the state and after each opened scene push video object to it and on pop scene pop the last video object from the history object... And return the previous object to the previous scene with Action.pop({video: VIDEO_OBJECT})... But if I showing the related videos in listview I need to save the scroll position of each scene (( And what about hardware back button...

May be I understand something wrong and there is a more complex and simple way...

  • If you are a complete newbie, starting with `redux` is so dangerous. You need a reason to use `redux`, don't just use it. Especially for a newbie you need to learn the rest. I recommend you just use react and then later add in redux. Also you are new so you probably don't know, but `react-native-router-flux` is not the go to, especially for newbies. It is `react-navigation`. It is super simple check it out - https://reactnavigation.org/ - you can have your route set up just by copy pasting from that page. – Noitidart May 29 '17 at 18:53
  • I think, it's very inconvenient to use react without redux. – Сергей Сергеев May 30 '17 at 10:49
  • As a beginner if you feel you can do it, go for it. – Noitidart May 30 '17 at 10:54
  • Thanks for your answer. I wrote some apps without it. Its more comfortable to write code with redux help. And I think that using react-navigation does not solve the problem. The problem is that the newly opened scene modifies its props, but when this scene pops - props of the previous scene, that shows after poping, are modified too. Because actually it is ONE scene wit ONE component. `` – Сергей Сергеев May 30 '17 at 11:01

1 Answers1

0

Ok. I found a problem. the problem was in my misunderstanding how all things works together. Now it works well as needed.