Skip to content

Conversation

@frony
Copy link
Owner

@frony frony commented Sep 3, 2025

onChange bugs

  • Stored the result of getElementById in a variable and access innerHTML only after confirming the element is not null
  • Added an interface to define the structure of advocate objects and typed the state arrays with useState<Advocate[]>([]) to tell TypeScript what type of data they contain
  • Fixed the event handler with proper typing: e: React.ChangeEvent
  • Fixed the filtering logic:
    • Changed advocate.specialties.includes(searchTerm) to advocate.specialties.some(specialty => specialty.includes(searchTerm)) since specialties is an array
    • Changed advocate.yearsOfExperience.includes(searchTerm) to advocate.yearsOfExperience.toString().includes(searchTerm) since years of experience is a number
  • Fixed the map function with proper parameter types and added a key prop

Table bugs

  • Added a tr between thead and th

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants