Skip to content
RED SAGSkills
medium10 pts · first answer countsreact-statereact-hooks

Syncing derived values with an effect

What is the best way to improve this component?

const [first, setFirst] = useState('')
const [last, setLast] = useState('')
const [fullName, setFullName] = useState('')
useEffect(() => {
  setFullName(first + ' ' + last)
}, [first, last])
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions