To set the state of responsive components in a browser, you can bind a function to a window object that will trigger a given state.
In the react component builder, you can do this.
constructor (props){ super(props); window.changeComponentState = (stateObject) => { this.setState ({stateObject}); } }
In the browser console you can do this.
window.changeComponentState ({a:'a'});
A WARNING. This is an anti-pattern. This will work, but you should never do this.
source share