import React, {useState} from "react"; import Preview from "./Preview"; import "./css/HomePage.css" class HomePage extends React.Component { // stores all available movies data = null; // stores current index of loaded elements loadindex = 0; constructor(props, context) { super(props, context); this.state = { loadeditems: [], sideinfo: { videonr: null, hdvideonr: null, sdvideonr: null, categorynr: null } }; } componentDidMount() { document.addEventListener('scroll', this.trackScrolling); const updateRequest = new FormData(); updateRequest.append('action', 'getMovies'); // fetch all videos available fetch('/php/videoload.php', {method: 'POST', body: updateRequest}) .then((response) => response.json() .then((result) => { this.data = result; this.loadPreviewBlock(12); })) .catch(() => { console.log("no connection to backend"); }); } componentWillUnmount() { this.setState({}); document.removeEventListener('scroll', this.trackScrolling); } render() { return (