scrimba
Reusable React
Components & refs
The useRef Hook
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
The useRef Hook
Expand for more info
index.js
run
preview
console
import React, { useState, useRef } from 'react';
import ReactDOM from 'react-dom';

const App = () => {
const [name, setName] = useState('')
const [email, setEmail] = useState('')

return (
<section>
<h2>Email Signup</h2>
<input type="text" value={name} placeholder="Name" onChange={(e) => {
setName(e.target.value)
}} />
<input type="text" value={email} placeholder="Email" onChange={(e) => {
setEmail(e.target.value)
}} />
</section>
)
}

ReactDOM.render(<App />, document.getElementById('root'));
Console
/index.html?
-4:24