import React from 'react'; import {render} from 'react-dom'; import {Router, Route, browserHistory, IndexRoute} from 'react-router'; import Api from './api'; import Home from './sites/home'; import Category from './sites/category'; import Header from './partials/header'; import Footer from './partials/footer'; class Flox extends React.Component { constructor() { super(); this.state = { logged: true }; this.checkLogin(); } render() { return (
{React.cloneElement(this.props.children, {logged: this.state.logged})}
); } checkLogin() { Api.checkLogin().then((value) => { this.setState({ logged: value.logged }) }); } } render(( window.scrollTo(0, 0)}> ), document.querySelector('.flox'));