DEV Community

Discussion on: React Hook, to copy?

Collapse
 
ivan_jrmc profile image
Ivan Jeremic

So first of all in react we don't use id to interact with the elements, if you want to copy the user input of the input element you must do it the react way.

Collapse
 
yobretyo profile image
Bret

So by className?

Collapse
 
yobretyo profile image
Bret

What would the react way be?

import React, { useState } from 'react'

function Snippets() {
return (

    </div>
)

}

function Snippet() {
const [copy, useCopy] = useState(true)
const [snippet, setSnippet] = useState([
{
name: 'post 1',
text: 'sample post',
},
]);
}

export default Snippets