Still trying to understand React state.
slides won't change so it's not state.
count changes so it's state.
currentSlide changes based on count. Should it be state?
Thank you for any help!
const slides = [
{ background: 'blue', heading: 'Hi' },
{ background: 'pink', heading: 'Hola' }
];
function Home() {
const [count, setCount] = useState(0);
let currentSlide = slides[count]; // should currentSlide be state?
useEffect(() => {
// interval incrementing count every 10 seconds
});
return (
<div bg={currentSlide.background}>
</div>
);
}
export default Home;