React · Middle · Question 52 of 75

Where should code that runs because the user clicked "Buy" go?

Explanation

Effects are for synchronizing with external systems because the component is displayed. Logic caused by a specific interaction belongs to that interaction's handler.

Further reading

Problem with a question

React · Middle · question 52

Test yourself

Take the React · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz