hero background

Speaker's Profile

Daniel Afonso

Daniel Afonso

Developer Advocate, OLX Group

Twitter

About Me

Daniel is a Developer Advocate at OLX Group. His current interest is in React and JavaScript, and he advocates for better testing principles using the testing library. He has a full-stack background, having worked with different languages and frameworks on various projects from IoT to Fraud Detection. In his free time, when he's not learning new technologies or writing about them, he's probably reading comics or watching superhero movies and shows.

About the session

React Hooks broke my tests, now what?

Hooks have become a better and cleaner way to write React code. Many have realized it and migrated their solutions from class to functional components. When the code looks great, and the migration seems successful, your tests may disagree.

This presentation focuses on the common pitfalls of testing and what we have been doing wrong while also teaching you how to test your brand new hooks using components, all this while using the React Testing Library.

I’ve been advocating for better testing practices using the Testing Library and have occasionally contributed to it. After spending months of refactoring implementation details focused tests, I’ve grown to understand the main pain points of testing React components and helped my team to build new practices and write better performant and resistant tests.

This talk consists of a real-life story of when at a previous company, we decided to migrate our 4 months old application from class components to functional ones and use React Hooks. It approaches the motivations for this migration (code reusability, code readability and the ease of teaching React to future Junior hires) and focuses on the main pain point we had: More than half of our tests failed.


Our tests were strongly focused on implementation details. This talk will approach how we dealt with this, and, how we discovered the React Testing Library.

03rd Oct, 2023

04:35 PM - 05:05 PM

SEE FULL SCHEDULE

Book A Ticket