Click here to Skip to main content
15,940,550 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have an input field and a button with the value "Text". I just want to append the input field with the button's value by onClick.

What I have tried:

function Screen() {
  return <input id="calc" type="text" name="answer"></input>;

function Button() {
  return (
      onClick={() => {
        //What to write here to append "calc"?

function App() {
  return (
      <Screen />
      <Button />

export default App;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900