score:0
you could use a ref
to get the current value of the textarea
. i did a small repro on stackblitz and here is the code :
import react from "react";
import "./style.css";
export default function app() {
const textarearef = react.createref();
const [val, setval] = react.usestate();
const copy = _ => {
setval(textarearef.current.value);
}
return (
<div>
<textarea ref={textarearef}></textarea>
<editortoolbar copy={copy} />
<hr />
copied value: {val}
</div>
);
}
const editortoolbar = ({copy}) => {
return <button onclick={copy}>copy</button>
}
Source: stackoverflow.com
Related Query
- ContentEditable is not updating virtual DOM
- Why is the DOM not updating with state change in ReactJS?
- React not updating the DOM (Laravel)
- React | Virtual DOM element click event not triggering
- React | Virtual DOM Modal is not showing
- DOM Not Updating although function changes var
- setState is not updating DOM
- React component DOM not updating
- React Dom not updating after updating a state array
- React Hooks: contentEditable not updating
- react router dom is not updating class component when url change
- Nextjs: Component is not updating the DOM when cookie is removed but updating when cookie is added
- React setState in onClick method not updating the DOM
- DOM render not triggering after updating hooks
- React DOM not updating on state change
- Updating state with React does not update DOM in IE9
- React dom not updating with Redux store
- Reactjs not updating dom classes after splicing state
- React - Method not updating DOM
- React class component inside react hook - DOM not updating
- Invariant Violation: _registerComponent(...): Target container is not a DOM element
- Why is React's concept of Virtual DOM said to be more performant than dirty model checking?
- State not updating when using React state hook within setInterval
- React setState not updating state
- React Child Component Not Updating After Parent State Change
- React setState not Updating Immediately
- React Error: Target Container is not a DOM Element
- useSelector not updating when store has changed in Reducer. ReactJS Redux
- React wrapper: React does not recognize the `staticContext` prop on a DOM element
- How to solve Warning: React does not recognize the X prop on a DOM element
More Query from same tag
- How to make a table responsive in Semantic-UI-React?
- React. Is it bad if presentational components contain container components?
- React TypeScript: Save array of strings to state and display array in unordered list
- is there simple way to display React component and pass dynamic events?
- React Search Bar with Hooks
- Rendering text boxes using map function for each object in this.state array. how can i handle text in the text area
- Adding <a> tag to App.js Constructor from Component Props
- Check jshint errors before npm run build
- defining a function to pass it as props, but I get a compiling error
- React error: "could not find the 'store' in the context of ..."
- Uncaught TypeError: Cannot read property 'history' of undefined
- ReactGA not working for G type tracking Id
- disable react css transition group on certain events
- Typescript - What type of function is it?
- How to return objects that have matching value when comparing to a separate array
- Update complex object
- Click on a card and then navigate to card page with details ,in react
- How to set parameter for onClick event
- GH Pages shows my homepage, but not any of my other paths
- Managing focus within a compound component
- Displaying HTML Body on a page using ReactJS
- ReactJS Design Patterns - Class vs. Custom Component
- Reactjs delete an item from Dexie.js
- Jest + Typescript lint error: TS2339: Property 'store' does not exist on type 'IntrinsicAttributes
- Flow type errors due to missing data prop after applying apollo's graphql() HOC
- React - get data from API and show in return using MAP function
- react material-table's search filter does not work on render
- How to set the platform on a per test basis for jest tests?
- React js not displaying '<a href...' as a link
- React Router 4 -- listen to route actions and programmatically continue/stop routing