If you do not control the code, you will have to mess with the internals of React in order to change component states. You will need to run a script in the world of the page for that, as only the DOM itself is shared between the content script world and the world of the page. Any page-created variables/fields/members/classes/functions are not shared.
React adds some internal data to every element in its tree, so, say, divElement.__reactFiber$owts4s8nwc (note that the field name is different for every page load or something, but it starts with __react, which you can find via Object.getOwnPropertyNames(divElement)) has some data that you might be able to use to get to what you want.
If you do control the code, you can use window.postMessage from your content script to send a message to the page and vice versa, or a custom event.