score:1
Accepted answer
basically you are assigning a value to eventdesc
with a default value of props.eventdesc
. but if you are not passing that value(should be undefined
) or you are passing a null
value you will get that behaviour.
you can add a default value on your render to solve this:
const { eventdate ="", eventdesc = "", eventname = "", eventpic = "" } = this.state;
but the best should be to have a default value on the constructor so you do it only once:
constructor(props) {
super(props);
this.state = {
eventname: props.eventname || "",
eventdate: props.eventdate || "",
eventdesc: props.eventdesc || "",
eventpic: props.eventpic || ""
}
}
Source: stackoverflow.com
Related Query
- Cannot read property 'refs' of null react error react js
- Uncaught TypeError: Cannot read property 'state' of null in react
- React component returning cannot read property '__reactInternalInstance$ of null after trying to access array
- React - Cannot read property 'setState' of null
- Cannot read property 'selectionEnd' of null using React + Jest + Datepicker + TextMask
- How to get over Cannot read property 'removeEventListener' of null in react
- TypeError: Cannot read property 'createEvent' of null React Apollo testing
- React tutorial: Uncaught TypeError: Cannot read property 'data' of null
- TypeError: Cannot read property 'value' of null in React Form
- React refs: Cannot read property 'focus' of null
- Cannot read property 'style' of null React
- React JS and Google Spreadsheets: Cannot Read Property '2' of Null
- TypeError: Cannot read property 'name' of null in react
- TypeError: Cannot read property 'substr' of null - React
- TypeError: Cannot read property 'length' of null in React Project
- Cannot read property 'setState' of null react
- TypeError: Cannot read property 'foo' of null - Object, React
- cannot read property of null using state in react
- React 0.14.0-RC1 / React-Router 1.0.0-RC1 - Cannot read property 'props' of null
- React Hooks : TypeError: Cannot read property 'firstName' of null
- TypeError: Cannot read property of null in React Component
- TypeError: Cannot read property <parameter> of null while passing data in React
- React TypeError: Cannot read property 'target' of null
- Uncaught TypeError: Cannot read property 'props' of null in React Class
- Uncaught TypeError: Cannot read property 'addEventListener' of null on react
- Uncaught TypeError: Cannot read property 'props' of null in react with google-maps
- TypeError: Cannot read property 'offsetHeight' of null when using the Locomotive Scroll react module
- TypeError Cannot read property 'country_code' of null
- TypeError: Cannot read property '0' of null in react
- REACT Uncaught TypeError: Cannot read property 'load' of null
More Query from same tag
- React Search Bar with Hooks
- Mapping array in React gives .map is not a function
- Axios not entering in catch - response interceptor
- React function component is updating the latest data even after rendering the component
- How to use popperComponent Props while using useAutoComplete in material ui reactJS
- Change props from imported component
- How to set aws amplify data in localStorage ReactJS
- Should I use Redux store.subscribe() or wrap my app with react-redux <Provider>?
- React-router doesn't render component after adding history
- Using Redux-Form for search filters, how can I "reset" and re-submit the form?
- How to update state of component in componentDidUpdate() without being stuck in an infinite re render?
- Display dynamic PDF from network drive in React App with Node server
- Update value after render
- ReactJS - Passing function deeper
- How do you await multiple axios calls with pagination in React?
- "unscoped" variable in react class module file
- How to get the DOM node of a child
- What happen if wrap a tag with navlink
- Semantic-UI-React: Form.Field is breaking layout
- How to write unit test for render component
- start an accordion menu on a specific item in react
- React Executing a method inside a component
- React - Arrow function vs bind() and event with argument
- How to add case insensitive sorting in react table?
- passing mobx-react-form object as a prop
- (React) TypeError: Cannot read property 'substr' of undefined
- Rails, paperclip, react: don't save image
- How to Give Dynamic Routing in react js using simple array of object file
- useReducer not accepting array or state
- How handle Fetch failures in Redux's action creators