1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00
chess/assets/js/app.js
2018-02-28 11:02:59 -05:00

37 lines
751 B
JavaScript

"use strict";
import "babel-polyfill";
import "phoenix_html";
import React from "react";
import ReactDOM from "react-dom";
import { createStore } from "redux";
import { Provider } from "react-redux";
import chessBoardReducer from "./reducers/chess-board";
const store = createStore(chessBoardReducer);
import ChessBoard from "./components/chess-board";
class App extends React.Component {
render() {
const { store, gameId } = this.props;
return (
<ChessBoard gameId={gameId} store={store} />
);
}
}
const container = document.getElementById("app");
if (container != undefined) {
const gameId = container.getAttribute("data-game-id");
ReactDOM.render(
<App store={store} gameId={gameId} />,
container
);
}