import React, {useState, useEffect} from "react"; import PropTypes from "prop-types"; import { Box, Button } from "grommet"; import axios from "axios"; import { CAMERA_URL, LIGHTS_URL } from "../config"; function SmartHome(props) { const [ idx, setIdx ] = useState(0); useEffect(() => { const id = setInterval(() => setIdx(i => i + 1), 20); return () => clearInterval(id); }, []); function turnOn() { axios.get(`${LIGHTS_URL}/on`); } function turnOff() { axios.get(`${LIGHTS_URL}/off`); } return (