Why, when, how?
Avoid being slow down by a hard-to-use component (= maintainability)
A new feature in a component/module means that requirements changed, so better rework it to get a clean result (=extensibility)
As you read the code, solving a few small "code smell" can help getting familiar with the code
Most refactorings comes from a simple idea
Most refactorings can be done progressively while you're coding, as you need it.
The idea: do small changes to be sure that nothing will break
Making small changes is easier
Every step looks too simple to be worth doing
Demo time
To go further:
UserList and Feed are displaying infinite list of items with a very similar logic, let's refactor them.
Refactoring - Improving the Design of Existing Code
by Martin Fowler
(with Kent Beck, John Brant, William Opdyke, and Don Roberts)