Implement a Dynamic Todo List with React Hooks
You are tasked with building a simple TodoList component using React hooks. The component should allow users to add new items to a list and remove existing items. Your solution should: * Manage the list of items using the useState hook. * Properly handle input field state for new items. * Implement an addItem function that adds a new todo item to the list. * Implement a removeItem function that removes a todo item by its index. * Ensure state updates are immutable to prevent common React pitfalls and ensure optimal re-rendering behavior. The starter code provides a basic structure, but it contains several issues related to state management and immutability that need to be addressed.
Use the "Verify Solution" button to get AI feedback on your React code.