score:3
Accepted answer
based on the image you added, the error seems to occur on render
function, so the componentdidmount
never gets triggered for this exact reason.
try checking if this.props.productcategories
exists before trying to use .map()
on it. this should allow render
function to run succesfully, and this will then trigger the componentdidmount
as per react's lifecycle method order
this.props.productcategories && this.props.productcategories.map((pc, i) ...
also, try removing the export
on your first row, keeping just the export default
of your last row where you also make use of connect
hoc, like:
class productcategory extends component {
// ...
}
export default connect(mapstatetoprops, mapdispatchtoprops)(productcategory)
Source: stackoverflow.com
Related Query
- componentDidMount not called, its not working at all it seems
- componentDidMount seems not to be called after setState in ReactJS
- Is componentDidMount of parent called after all componentDidMount of children?
- React Native FlatList horizontal mode not working at all
- componentDidMount not being called after goBack navigation call
- Why is componentDidMount not being called when I re-render?
- removeEventListener not working when called in componentWillUnmount
- componentDidMount not called
- Configuring redux to display on all browsers is not working correctly
- window.postMessage not working in componentDidMount without setTimeOut in React
- react-hook-form not working when onSubmit called
- Why is requestAnimation frame called multiple times for some frames, and not at all for others?
- ReactJS: css transition not working in componentDidMount
- mapStateToProps not getting called at all
- ComponentDidMount not getting called after redux state update?
- I am trying to use the react hook useContext() but its not working
- React Hooks state not working properly when the function calling it is called in another function
- Rendered component in Route does not fire its componentDidMount
- ComponentDidMount redux-saga action not working
- Typescript React componentDidMount not getting called
- Text in a div crosses its boundaries and text padding not working
- componentDidMount not called when Route with a different param is called
- I am using react-tinymce and its onChange prop is not working properly, it only call on few events, I want to call it on onKeyup event
- React.js - componentDidMount not called when using renderComponentToString
- reactjs: a context component function not updating its variable; usestate not working immediately?
- Why are my POST and PUT requests from Node/Express not working in React/Redux? My GET and DELETE requests all work fine. All requests work in Postman
- Anchor Link Libraries not working at all in my React project
- Tracker.autorun not working inside componentDidMount of react
- trying to make a React dropdown with checkbox options in it and its not working properly
- useEffect is not called appropriate time, so useState in useEffect is not working
More Query from same tag
- onclick not firing in react
- How to compare objects of two different arrays in javascript
- Too many API requests are sent when loading ReactJS page
- Why {...rest} can be used in attributes
- No-unused-expressions issue React
- Passing props in React Typescript using custom hooks
- Centering table created using array map in react web app
- Webpack ReferenceError: require is not defined (ReactJS)
- On click and mouse up in same component in react?
- Use ref in Higher Order Components
- How to render a loading component with the useEffect hook?
- How can I hide a table when tbody is empty?
- ReactJs - Search filter with Object.keys().map - Uncaught TypeError: this.state.texts.filter is not a function at t.value
- How to set state for variable function
- React setState doesnt update state while changing an image
- React.js: Make content of dropdown dynamic from API
- dispatch is not defined inside async action creators
- How to manage components/widgets which can be added/removed dynamically by the end user
- How to use whitelist in redux-persist v5?
- Material-UI Autocomplete onChange not updates value
- How to trigger an event after any (re)render of a React/Redux app
- React: How to solve the error: Object is of type 'unknown'?
- How to implement onBlur/onFocus for a div with nested input fields?
- Changing styles depends on state
- how to put every third element from an array map into a div react
- replace componentWillRecieiveProps in react 16 in redux?
- React Router List and Detail Route at the same time
- Why do fetch errors not have a stacktrace in my single page application?
- importing images into ReactJS programmatically?
- Why doesn't this d3 component work when the input type changes?