njsfield / chess

A Chess app, built with React and Redux, utilising FEN with the Chess.js library
https://njsfield.github.io/chess/
1 stars 1 forks source link

State inside of store #3

Closed njsfield closed 7 years ago

njsfield commented 7 years ago
njsfield commented 7 years ago
  1. Store initialised with FEN string.
  2. Fen string state is sent as props to board container
  3. Board container takes fen string, then filtered to array of items-
    fen = fen.split(' ')[0].split('').filter(x => /[a-z]/i.test(x));

    Then mapped to array of objects...

    {
    color: 'w'
    piece: 'r',
    code: '♖'
    position: 'A1'
    }
  4. Board container then maps array to items