Create a Lightning Web Component (LWC) that dynamically adds new elements to an array from a user input text field and displays them on the screen when a submit button is clicked.
Complete the provided practice example code to add new items to an array and display the list on the screen.
Instructions
- Create a lightning-input field with the label "Name".
- Create a lightning-button with the label "Submit".
- When the submit button is clicked, add the new name entered in the input field to the names array and display the updated list of names inside a <p> tag.
Sample output

Note : This exercise introduces you to writing a simple LWC component that dynamically add new elements to an array based on input text. Focus on meeting the requirements, and feel free to validate your code using the execute button.
Hint: If the JavaScript array isn't re-rendering the new elements, consider declaring the array as a reactive property using @track to trigger a re-render when the array is updated.
To learn more about lightning web components, click here to visit the lightning web components developers guide