You should fight a fire with a fire extinguisher only when all the following are true:
Everyone has left or is leaving the building.
The fire department has been called.
The fire is small and confined to the immediate areas where it started such as in a wastebasket, cushion, small appliance, stove, etc.
You can fight the fire with your back to a safe escape route.
Your extinguisher is rated for the type of fire you are fighting and is in good working order.
You have had training in use of the extinguisher and are confident that you can operate it effectively.
Remember, if you have the slightest doubt about whether or not to fight the fire - don't. Instead, get out, closing the door behind you to slow the spread of the fire. You have one of the best fire departments in the world standing by ready to protect you. Let the professionals do their job.