What is the easiest way to launch a node.js script from a react-app by using a button?
I've a simple app with two buttons - using Material.io
export default function ButtonsMenu() {
const classes = useStyles();
return (
<Grid>
<Grid item xs={12}>
<Paper style={styles.Paper}>
<Button onClick={activeLights} variant="contained" color="primary" className={classes.button}>
ON
</Button>
<Button onClick={inactiveLights}variant="contained" color="secondary" className={classes.button}>
OFF
</Button>
</Paper>
</Grid>
</Grid>
);
I also have an Arduino with led stripe that i wrote a node.js code for. How can i run it from the browser?
I know that i need a node server and a client, but need some help what should i do next.
I would appreciate any github repository etc.
You can't do that, ReactJs is for fornt using, but instead make an API call to a node js server, even the browser will block you from calling local commands
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.