There’s something deeply satisfying about refactoring React components. But nothing kills your joy like unintentional changes to existing functionality! This talk will cover some strategies for making refactoring a less painful experience for all of us.
There’s something deeply satisfying about refactoring React components. Refactoring can help us to simplify, create a foundation for the future, and better communicate our intentions for our codebase. But nothing kills your joy like unintentional changes to existing logic! This talk shares some tips and tricks for stress-free refactoring, like aiming for simplification of logic over premature abstraction, and testing behavior without getting bogged down in implementation details. With a little bit of time and intentionality, we can keep the code that brings us joy and refactor all the rest.
Like a lot of other software developers, I have done a lot of “refactoring”, but haven’t always done it well. I have tried to refactor code bases that were hastily written without tests, and run into a lot of difficulties along the way. In my experience, learning to refactor well is a vital, but often overlooked skill.
- What is refactoring?
- Why should we do it?
- How do we do it?
- Integration testing - documenting and testing existing behavior
- Renaming and cleaning up component props
- Removing messy conditional logic