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)
3
  • 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. Commented Aug 4, 2020 at 18:44
  • AmerLLicA thank you. It worked! The documentation must be outdated because it says that this is needed. Commented Aug 4, 2020 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. Commented Aug 5, 2020 at 6:59

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.