Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are options to debug a React Native + Redux app?

I have been researching options to debug a React Native + Redux app. Especially the redux part. What is your preferred way to do this? Hope to know!

like image 926
Tetsuya3850 Avatar asked Mar 22 '19 01:03

Tetsuya3850


4 Answers

I use React Native Debugger as stand-alone-version for this. It is able to show the full history of redux-state changes and give you some handy tools like Raw-View, Chart-View or Diff-View. And you don't have to add anything in your App-Code (like for Reactotron).

It looks like this:

enter image description here

To activate the Redux-Panel, you only do a right-click at the Debugger window and choose Toggle redux devtools.

like image 123
suther Avatar answered Oct 14 '22 20:10

suther


Thank you all for the recommendations, I tried out the four options! I even wrote a medium article on this topic.

My conclusion, Use React Native Debugger. (Guide to setup)

Since,

v.s. redux-logger: lacks functionality, additional dependency per project

v.s. Remote Redux Devtools: lacks functionality, additional dependency per project, additional code.

v.s. Reactotron: Unfamiliar interface, additional dependencies per project, additional code.

like image 41
Tetsuya3850 Avatar answered Oct 14 '22 20:10

Tetsuya3850


I normally use DevTools, but that's a Chrome extension and not for Simulator. Perhaps you can look into remote monitoring with it: https://github.com/zalmoxisus/remote-redux-devtools I believe you would be able to set this up to monitor Store interactions in Simulator remotely.

Edit: Yes it actually is meant for React Native after reading more of the README. I would use this for sure.

like image 39
shanemacbride Avatar answered Oct 14 '22 18:10

shanemacbride


There are multiple tools are beneficial for developers when dealing with redux, and out of all of em, I highly recommend using both below

Reactotron:

- view your application state
- show API requests & responses
- perform quick performance benchmarks
- subscribe to parts of your application state
- display messages similar to console.log
- track global errors with source-mapped stack traces including saga stack - traces!
- dispatch actions like a government-run mind control experiment
- hot swap your app's state using Redux or mobx-state-tree
- track your sagas
- show image overlay in React Native
- track your Async Storage in React Native

Redux-logger:

It helps to show you the previous state, current action payload and next state whenever we dispatch a redux action, which you should see how it's benefiting us

like image 24
Isaac Avatar answered Oct 14 '22 19:10

Isaac