What is the optimal way to write this small Todo List app
If you had not written this code but were trying to use it, how would you know that the square on either side was a button or what the function of that button was? Buttons need labels and they are generally oval shaped.
When you design or write code for the web you need to consider the user and how they will be using the tool. Even a toy application should follow some basic standards.