React works by changing the DOM of the page and renders any changes that are made to the DOM during the interaction/update of the page. These DOM changes can be done by a user or automatically by the system. It detects the changes made to the DOM and only updates those specific changes, this makes it fast for dynamic websites as only a small portion of the HTML code is changed without reloading the full webpage.