2

To setup React Native debugger we have to declare a composer like this:

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose

const store = createStore(
  rootReducers,
  composeEnhancers(applyMiddleware(thunk))
)

But when using with typescript TS Compiler says: Cannot find name 'window'.ts(2304)

Already tried changing the key lib in tsconfig.json to this:

"lib": ["es6", "DOM"]

But the error changes to:

Property '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__' does not exist on type 'Window & typeof globalThis'.ts(2339)
Luna
  • 467
  • 1
  • 3
  • 11
  • 1
    Is it your project `React Native`? if yes, you don't need to setup it like this, just use it, the React Native Debugger catch it. – AmerllicA Aug 04 '20 at 18:44
  • AmerLLicA thank you. It worked! The documentation must be outdated because it says that this is needed. – Luna Aug 04 '20 at 18:56
  • I'm happy that it helps you. I leave an answer for documentation. please mark it as the correct answer to other future visitors. Also, I leave an upvote to your question. – AmerllicA Aug 05 '20 at 06:59

1 Answers1

1

Actually, React Native Debugger doesn't need to setup. Just use Redux and React Native Debugger will catch your state.

Using __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ need to write window. __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ and the window object is just for browswer.

AmerllicA
  • 29,059
  • 15
  • 130
  • 154