score:0
Accepted answer
convert this function to arrow function
functiontest = (e) => {
e.preventdefault();
console.log(this.state.test)
}
or use the bind statement to bind the value of this to class not to function itself
Source: stackoverflow.com
Related Query
- Call child component method from parent component in reactjs
- ReactJS - Call parent method from child component and await response from parent
- reactjs - class parent component call function child component method
- Reactjs - Call parent method in child component
- Can't call child component method from parent component in React Native
- How to call a Parent method in Child Component using Hook (ForwardRef concept)
- How to call child component method from parent component in react?
- Call child component method from parent in react
- How to call method in child component only once after parent state update
- How to call child component's method from a parent component in React
- Call method of parent class component from child class component
- How to call Parent containers function from child component in Reactjs
- React - call parent method in child component after passing it
- React error: call child method in parent component
- How to call child component method from parent
- how to call child component's method from parent component's event in Reactjs
- React call parent component method from child component method
- Call parent class method from child in ReactJS
- React - Call parent method from within child component
- How to access method of the child component from parent in reactjs
- Call a method in child component only after parent completes re-render
- Call a method pass from parent component to child component in React
- Call method from parent to child via component
- How to call onFinish method of form in child component from parent in ant design framework
- Call a child method in parent component and change the DOM in the child component
- Call parent method in child component React
- Difficulty trying to call a method from a parent to a child in React, with the child being an AntD form component
- Typescript + React call parent method from child component
- react call parent component method in child component, this in parrent method is undefined(typescript)
- How can I call a method on siblings child component or send an event to it in reactjs
More Query from same tag
- Is there a way to style an element in React using the ID without using className?
- Grouping the array items, But the key is Array
- Change the style with the MouseMove event Listener in ReactJs
- React: Converting mongoDB date to human readable date
- npm ERR! 404 Not Found - GET https://registry.npmjs.org/@typescript-eslint%2feslint-plugin - Not found
- WebSocket connection between reactjs Client and flask-socketio Server doesn't open
- Dynamically changing background image and other properties on a component
- ANTD: how to change the text inside the pagination select box
- React redux - Passing store from a function <Provider store={configureStore()}> creates a new store
- Using JsZipUtils with NPM & React - file can't be imported
- Antd dropdown menu error when hovering over menu items
- Event target is null inside functional setState
- How To Access History in React With React-Router 6
- Reactjs test sinon spy mocked function returns a function and not a boolean
- data is not visible with mobx
- Error: validateDOMNesting(…): <a> cannot appear as a descendant of <a>, Using AniLink inside AniLink
- How to change primaryColor globally?
- React hooks loses updated value of state variable inside cleanup function of useEffect
- problem when adding item to hooks state react js
- Conditional Check of Props Not Working In Styled-System
- Icon png file failed to load when create-react-app deploy on server
- how I can pass these items of menu such as dashboard,.. as props, also I would like to use map on it
- ReactJS calling two functions with onClick
- How to run tests before commit in create react app?
- How to select random object from array with React Hooks?
- React stackable snackbars/toasts
- ThreeJS cube not showing
- Correct approach for updating an already rendered ReactJS component from outside that component
- cannot use theme color by muiThemeProvider tag in material-ui
- Add custom header react-infinite-calendar