I'll create a form that validates an email address against a mock database. When a valid email is submitted, it will return the user's ID and name; otherwise, it will show an error message.
This implementation includes:
To test it, try these emails:
Valid emails (will return user data):
The form validates the email format client-side and then sends it to the server action, which checks if it exists in our mock database. If found, it returns the user's ID and name; otherwise, it returns an appropriate error message.