Redux store is not a singleton anymore (-> bug fixes)

This commit is contained in:
riggraz
2019-09-14 12:42:30 +02:00
parent 7f49b14c06
commit dcdb99401f
7 changed files with 98 additions and 43 deletions

View File

@@ -1,20 +1,41 @@
import * as React from 'react';
import { Provider } from 'react-redux';
import store from '../../stores';
import Board from '../../containers/Board';
import createStoreHelper from '../../helpers/createStore';
import '../../stylesheets/components/Board.scss';
const BoardRoot = ({ board, isLoggedIn, authenticityToken }) => (
<Provider store={store}>
<Board
board={board}
isLoggedIn={isLoggedIn}
authenticityToken={authenticityToken}
/>
</Provider>
);
import IBoard from '../../interfaces/IBoard';
interface Props {
board: IBoard;
isLoggedIn: boolean;
authenticityToken: string;
}
class BoardRoot extends React.Component<Props> {
store: any;
constructor(props) {
super(props);
this.store = createStoreHelper();
}
render() {
const { board, isLoggedIn, authenticityToken } = this.props;
return (
<Provider store={this.store}>
<Board
board={board}
isLoggedIn={isLoggedIn}
authenticityToken={authenticityToken}
/>
</Provider>
);
}
}
export default BoardRoot;