Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.(5)

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

ITtutoria

ITtutoria Logo ITtutoria Logo

ITtutoria Navigation

  • Python
  • Java
  • Reactjs
  • JavaScript
  • R
  • PySpark
  • MYSQL
  • Pandas
  • QA
  • C++
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA
Home/ Questions/What is the typeerror: cannot read property 'apply' of undefined problem, and how to solve it?
Next
Answered
Ari Walsh
  • 6
Ari Walsh
Asked: May 18, 20222022-05-18T20:19:38+00:00 2022-05-18T20:19:38+00:00In: javascript

What is the typeerror: cannot read property ‘apply’ of undefined problem, and how to solve it?

  • 6

. Advertisement .

..3..

. Advertisement .

..4..

I encountered the following problem in completing my work:

TypeError: Cannot read property 'apply' of undefined

Below is the code I ran:

import { createStore, applyMiddleware,compose } from 'redux';
 import thunk from 'redux-thunk';
 import rootReducer from './reducers';
 
 const initialState={};
 
 const middleware = [thunk];
 
 const store = createStore(rootReducer,initialState,
  compose(
  applyMiddleware(...middleware),
  window.__REDUX_DEVTOOLS_EXTENSION__&& window.__REDUX_DEVTOOLS_EXTENSION__()
  ) 
  );
 
 
 export default store;
"@material-ui/core": "^3.3.1",
  "@material-ui/icons": "^3.0.1",
  "axios": "^0.18.0",
  "jwt-decode": "^2.2.0",
  "prop-types": "^15.6.2",
  "react": "^16.6.0",
  "react-dom": "^16.6.0",
  "react-redux": "^5.1.0",
  "react-router-dom": "^4.3.1",
  "react-scripts": "2.0.5",
  "react-select": "^2.1.1",
  "recharts": "^1.3.5",
  "redux": "^4.0.1",
  "redux-thunk": "^2.3.0",
  "typeface-roboto": "0.0.54"
"dependencies": {
  "bcryptjs": "^2.4.3",
  "body-parser": "^1.18.3",
  "express": "^4.16.4",
  "mongoose": "^5.3.11",
  "multer": "^1.4.1",
  "passport": "^0.4.0",
  "passport-jwt": "^4.0.0",
  "path": "^0.12.7",
  "validator": "^10.9.0",
  "xlsx": "^0.14.1"
  },
  "devDependencies": {
  "concurrently": "^4.0.1",
  "nodemon": "^1.18.6",
  },

What’s causing it, and how can it be resolved in the “typeerror: cannot read property ‘apply’ of undefined“ in the javascript?

cannot read property apply of undefined
  • 2 2 Answers
  • 50 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

2 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. Best Answer
    hdtutoria Expert
    2022-06-20T03:29:24+00:00Added an answer on June 20, 2022 at 3:29 am

    The cause: This error happens because compose from redux wants all of its parameters to be functions. As a result,

    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() 

    returns a boolean when it is evaluated in that environment. 

    Solution: To solve this error, you’d have to return a function that doesn’t return anything.

    window.__REDUX_DEVTOOLS_EXTENSION__
      ? window.__REDUX_DEVTOOLS_EXTENSION__()
      : f => f
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Aaron Pruvost
    2022-05-25T21:03:49+00:00Added an answer on May 25, 2022 at 9:03 pm

    This was the same problem I encountered when I tried to test my web application on an incognito browser (extensions do not show up in incognito windows).

    compose from redux assumes that all arguments should be functions. What then?

    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() 

    It returns a boolean if it is evaluated in this environment.

    @knutwalker pointed out. It would be necessary to return a function which returns nothing. It worked for me.

     window.__REDUX_DEVTOOLS_EXTENSION__
     ? window.__REDUX_DEVTOOLS_EXTENSION__()
     : f => f
    • 24
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question
  • How to Split String by space in C++
  • How To Convert A Pandas DataFrame Column To A List
  • How to Replace Multiple Characters in A String in Python?
  • How To Remove Special Characters From String Python

Explore

  • Home
  • Tutorial

Footer

ITtutoria

ITtutoria

This website is user friendly and will facilitate transferring knowledge. It would be useful for a self-initiated learning process.

@ ITTutoria Co Ltd.

Tutorial

  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA

Legal Stuff

  • About Us
  • Terms of Use
  • Privacy Policy
  • Contact Us

DMCA.com Protection Status

Help

  • Knowledge Base
  • Support

Follow

© 2022 Ittutoria. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.