That depends on the amount of the repair and the expected life left in the water heater. If the cost to repair is low, then it is probably better to repair it. If the cost is high and the water heater is old, it is better to replace it. Be aware that the repair may be covered by a warranty, so it is always a good idea to check the warranty information.