In this component I'm not sure if I should use createRef and useRef to get the information from the input. Can you please help me figuring out how I should choose one or the other? Thanks in advance
import React from 'react'
const AddBook = (props) => {
const handleNewBook = props.handle
let titleInput = React.createRef();
let authorInput = React.createRef();
return (
<div className="add-book">
<span className="add-book-title">Add a book:</span>
<form>
<input type="text" ref={titleInput} placeholder="Title" />
<input type="text" ref={authorInput} placeholder="Author" />
<button
type="reset"
onClick={() =>
handleNewBook(titleInput.current.value, authorInput.current.value)
}
>
Add
</button>
</form>
</div>
);
}
export default AddBook