@/store#TicTacToeGameState TypeScript Examples

The following examples show how to use @/store#TicTacToeGameState. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: selectors.test.ts    From react-js-tutorial with MIT License 6 votes vote down vote up
describe("Login selectors", () => {
  describe("selectIsAuthorized", () => {
    it("returns `true` for state with username", () => {
      expect(
        selectIsAuthorized(
          castPartialTo<TicTacToeGameState>({
            login: {
              username: "bob",
            },
          })
        )
      ).toBe(true);
    });

    it("returns `false` for state with no username", () => {
      expect(
        selectIsAuthorized(
          castPartialTo<TicTacToeGameState>({
            login: {
              username: "",
            },
          })
        )
      ).toBe(false);
    });
  });
});
Example #2
Source File: AccessChecker.tsx    From react-js-tutorial with MIT License 5 votes vote down vote up
mapStateToProps = ({ login }: TicTacToeGameState) => ({
  status: login.status,
})
Example #3
Source File: Background.tsx    From react-js-tutorial with MIT License 5 votes vote down vote up
mapStateToProps = (state: TicTacToeGameState) => ({
  ...selectors.background(state),
})
Example #4
Source File: reducer.ts    From react-js-tutorial with MIT License 5 votes vote down vote up
selectors = {
  background: ({ background }: TicTacToeGameState): { status: string } =>
    background,
}
Example #5
Source File: Chat.tsx    From react-js-tutorial with MIT License 5 votes vote down vote up
mapStateToProps = ({ chat, login }: TicTacToeGameState) => ({
  chat,
  ...login,
})
Example #6
Source File: Hash.tsx    From react-js-tutorial with MIT License 5 votes vote down vote up
mapStateToProps = ({ hash }: TicTacToeGameState) => ({
  children: hash,
})
Example #7
Source File: CreateCustomGame.tsx    From react-js-tutorial with MIT License 5 votes vote down vote up
mapStateToProps = ({ game }: TicTacToeGameState) => ({
  fieldSize: game.fieldSize,
  playerMarks: game.playerMarks,
  nextTurn: game.nextTurn,
})
Example #8
Source File: GameState.tsx    From react-js-tutorial with MIT License 5 votes vote down vote up
mapStateToProps = (state: TicTacToeGameState) => ({
  ...selectors.playerInfo(state),
})
Example #9
Source File: InteractiveField.tsx    From react-js-tutorial with MIT License 5 votes vote down vote up
mapStateToProps = ({ game }: TicTacToeGameState) => ({
  field: game.gameField,
})
Example #10
Source File: reducer.ts    From react-js-tutorial with MIT License 5 votes vote down vote up
selectors = {
  game: ({ game }: TicTacToeGameState) => game,
  playerInfo: ({ game }: TicTacToeGameState) =>
    pick(["moves", "nextTurn", "gameStatus", "winner"], game),
}
Example #11
Source File: Login.tsx    From react-js-tutorial with MIT License 5 votes vote down vote up
mapStateToProps = ({ login }: TicTacToeGameState) => ({
  ...login,
})
Example #12
Source File: User.tsx    From react-js-tutorial with MIT License 5 votes vote down vote up
mapStateToProps = ({ login }: TicTacToeGameState) => ({
  ...login,
})
Example #13
Source File: selectors.ts    From react-js-tutorial with MIT License 5 votes vote down vote up
export function selectIsAuthorized(state: TicTacToeGameState): boolean {
  return Boolean(state.login.username);
}