componentDidMount()

in static-site/app/js/app.js [42:54]


    componentDidMount() {
        window.addEventListener('resize', this.handleResize.bind(this));
        request({url: __TRIVIA_API__ + '/api/trivia/all'}).then(result => {
            let data = JSON.parse(result),
                rows = 0;
            data.forEach(category => {
                if (category.questions.length > rows) {
                    rows = category.questions.length;
                }
            });
            this.setState({data: data, rows: rows, cols: data.length});
        });
    }