I have the following in my React component
export default function BookAdderComponent(props) {
const booksPresenter = new BooksRepository();
return (
<>
<h5>Add Book</h5>
name : <input></input><br/>
title : <input></input><br/>
<button onClick={() => {
booksRepo.addBook({
id: 131,
name: "My Book", //.1 how do I bind to name input?
ownerId: "[email protected]",
author: "tom hurst" //.2 how do I bind to title input?
})
}}>
add book
</button>
</>
);
}
How do I 2-way-bind my two html input values to things I am going to send in my repository function later on?
I'm looking for the simplest easiest way I need to demo this to someone.
onChange. From there you can reference your state inaddBooke.gname : this.state.name