score:1
well, from what i know all you have to do is basicly use the "event" to get the value.
for example.
handleclick(e) {
//e- the event
this.setstate(state => ({
getpreferences: !state.getpreferences,
preferencearray: state.preferencearray.push(e.target.value)// the event traget value
}));
Source: stackoverflow.com
Related Query
- How to get values from react button onClick
- How to get values from the selected radio button in react js
- How can I get all the values from multiple select inputs on a button click? React
- How to get values from child components in React
- How to get values from react FieldArray in formik form with other fields?
- How to get the selected value from a radio button group in React where there are multiple groups?
- React & Typescript how get onClick prop from child to parent
- reactjs - how to get data from a child component into onclick of a button passed in props?
- How to get the TextField value with onclick button event React Material UI
- How to get event.target.name from react onClick event for table header (th)
- React js - How to get Click event values from child component to parent component?
- How to pass variable to graphql from method when onClick with button and get it's return data back?
- How to get the value from button group in react component
- How to get selected values from multiple dropdowns on button click using ReactJs
- How to get radio button and calender control values in react js
- how to get route param values of child component from parent component in app using React Router
- How to get values from multiple Textareas in React
- How to get current value onClick from an array of items in React js?
- React - How can I get the values from my multiple input and send them to my input?
- How to get new value from react ace editor on button click
- How to Get latitude and longitude from Google Maps React onClick
- how to get mapped data from list item onclick from child to parent in react
- How to concatenate URL and string, and get data from API at click a button using axios in REACT JS
- How to get and display specific data from onClick into another page in React
- How get multiple values from checkbox list into state using React useState hook
- How to get values from select react js
- Get object data and target element from onClick event in react js
- How to get "key" prop from React element (on change)?
- How to get "key" prop from React element (on change)?
- How to get values from input types using this.refs in reactjs?
More Query from same tag
- Need some assistance with Victory Charts
- In React, Is it good practice to search for certain element in DOM?
- Cannot set state on react component
- How to fix Form.control input width which changes when input type changes from "text" to "type"?
- Select the exact one cell from table and change state of this
- Refactoring a class based component to hooks (gapi API)
- Using CSS Modules and 3rd party packages
- How can I grab multiple mapped elements using useRef?
- Keep a label tag with date material ui
- How can I ensure that a ref is loaded when I need it to pass to another component?
- Adding and removing tracks from a Spotify playlist app
- React-resolver for data Mock
- How to ensure ref.current exists before firing on click function?
- Filter based on a nested value JavaScript / React
- How to assign to organizations in initialState actual array of objects instead of promise?
- How to reset input form on submit (ReactJS)
- Set state value depending on other states
- How to use Material UI TreeView with Recursive TreeItem Component with added state
- loading css/javascript file based on prop
- How to trigger action on mount, but after redux storage load
- Wrapping functional JSX components with other functions
- Clear all form fields at once, reactjs
- What do I wrap in `act` for state changes that are triggered by time and using modern fake timers
- React hooks useState submit on second time from child component
- React - Input in table row loses focus on input
- DRY with Props in React
- Jest & Enzyme - SyntaxError: Unexpected token import
- convert existing links to react router <Link to>?
- what does React setState() return?
- Missing the location, history and match properties when combining custom props with RouteComponentProps