How can temperature be constant during a reaction?
But how can the reaction occur at constant temperature


Despite the dynamic name, thermodynamics is not concerned about time. Or more precisely, the theoretical model/world-view of thermodynamics allows the reaction to take place over an infinite amount of time, so you have all the time you need to dissipate the heat and thus keep the same temperature constant (within arbitrarily small limits).

To get to practical reality, we have a whole arsenal of possibilities that cover a range from very close to the definition here to experimental conditions that are quite different from those stated here:

The closest one is: The reaction takes place in a thermostat, i.e. in a device that keeps the temperature constant. You may measure the amount of heat that needs to be transported into or out of the reaction vessel to keep the temperature there constant (within practical limits). 

As @MaxW says in their comment, you can also approximate this by using a reaction vessel that keeps the temperature approximately constant. 

@Maurices comment goes yet a step further: as long as the outcome doesn't change (e.g., no irreversible reations at the intermediate temperature), you may deliberately allow intermediate temperature changes as long as you can keep track of the heat exchange until the reaction products reach the starting temperature again.

And lastly, you could allow temperature change and do a series of experiments that then allows you separate in the data analysis temperature-dependent from temperature-independent parts.