Skip to content

Instantly share code, notes, and snippets.

@Horhik
Created February 23, 2020 20:38
Show Gist options
  • Save Horhik/28c40259a79fabdd358822cede105c09 to your computer and use it in GitHub Desktop.
Save Horhik/28c40259a79fabdd358822cede105c09 to your computer and use it in GitHub Desktop.
How to launch react devtools with react native and linux

React DevTools in ReactNative

  • download react-native-debugger from releases page
  • unzip package and launch rn-debugger-linux-x64/react-native-debugger (may be you'll need run chmod)
  • in you react-native app folder run:
### NPM
npm i --save-dev react-native-debugger-open # or -g
npm i redux-devtools-extension
### YARN
yarn add -D react-native-debugger-open # yarn global add ...
yarn add redux-devtools-extension

Setup store.js

import {createStore, applyMiddleware} from 'redux';
import {composeWithDevTools} from 'redux-devtools-extension';
import mainReducer from './reducers/main-reducer'; //your reducer

const composeEnhancers = composeWithDevTools({realtime: true, port: 8081}); //possible to run without arguments
const store = createStore(
  mainReducer,
  /* preloadedState, */ composeEnhancers(/*connect of middelwares*/),
);
export default store;

run:

REACT_DEBUGGER="rndebugger-open --open --port 8081" npm start # or yarn start
  • after, enable debug (press D in terminal)

  • launch react-native run-android // or run-ios

  • start ./react-native-debugger which you downloaded early

    enjoy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment