Debug School

rakesh kumar
rakesh kumar

Posted on • Updated on

Common Error in React js

Error:ADD_QUESTION_BEGIN' is not defined

Solution
In reducer.js
import ADD_QUESTION_BEGIN in reducer.js

import {
  ADD_QUESTION_ERROR,
  ADD_QUESTION_SUCCESS,
  ADD_QUESTION_BEGIN,
} from "./actions"
Enter fullscreen mode Exit fullscreen mode

in action.js

export const ADD_QUESTION_BEGIN = "ADD_QUESTION_BEGIN"
Enter fullscreen mode Exit fullscreen mode

Error: Uncaught (in promise) TypeError: addQuestion is not a function
In appcontext.js

<AppContext.Provider
      value={{
      addQuestion
          {children}
    </AppContext.Provider>
  )
Enter fullscreen mode Exit fullscreen mode

Error:state.clients.result is undefined

in reducer.js mention clients variable
Image description

ERROR:Feedback is not defined

Image description

============or===================

if (!Feedback || Feedback.length === 0) {
  return <p>No feedback found.</p>;
}
Enter fullscreen mode Exit fullscreen mode

ERRORS
Cannot read properties of undefined (reading 'length')
TypeError: Cannot read properties of undefined (reading 'length'

my code is

<h5>Total Feedback:{myfeedback.length} </h5>
Enter fullscreen mode Exit fullscreen mode

solution

<h5>Total Feedback:{myfeedback?myfeedback.length:null} </h5>
Enter fullscreen mode Exit fullscreen mode

How to debug if output in server console not shown

Image description

in server console

Image description

solution:

Image description

CASE2: how to debug not show output

Image description

my code is
In client side

Image description

Image description

Image description

router

Image description

Image description

error :

output:item: '[object Object]'
Enter fullscreen mode Exit fullscreen mode

Solution
in appcontext
Image description
controller function

Image description

===========================

Image description

Top comments (0)