{"size": 760, "ext": "js", "max_stars_repo_path": "JS/client.js", "max_stars_repo_name": "remko/react-swift-example", "max_stars_repo_stars_event_min_datetime": "2016-11-20T21:21:49.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-19T03:57:24.000Z", "max_issues_repo_path": "JS/client.js", "max_issues_repo_name": "remko/react-swift-example", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "JS/client.js", "max_forks_repo_name": "remko/react-swift-example", "max_forks_repo_forks_event_min_datetime": "2017-03-16T04:59:29.000Z", "max_forks_repo_forks_event_max_datetime": "2017-12-19T12:15:13.000Z"}
{"max_stars_count": 23, "max_issues_count": null, "max_forks_count": 5, "avg_line_length": 21.7142857143, "max_line_length": 66, "alphanum_fraction": 0.6894736842}
import React from 'react';
import { render } from 'react-dom';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import 'whatwg-fetch';
import 'es6-promise';

import Counter from './Counter';
import { rootReducer } from './reducers';

function load(state) {
	const store = createStore(rootReducer, state);

	render(
		<Provider store={store}>
			<Counter/>
		</Provider>,
		document.getElementById('root')
	);
}

// Check if we can preload the state from a server-rendered page
if (window.__PRELOADED_STATE__) {
	load(window.__PRELOADED_STATE__);
}
else {
	// We didn't prerender on the server, so we need to get our state
	fetch('/api/state')
		.then(
			response => response.json().then(load),
			err => console.error(err)
		);
}

