I have a state map in my react app which contains the pieces coordinates and info like
state = {
board: [
[
new Piece("0"),
new Piece("M"),
new Piece("0"),
new Piece("M"),
new Piece("0"),
new Piece("M"),
new Piece("0"),
new Piece("M")
],
],
turn: 1,
possibleMove: [],
possibleJumpMove: [],
clickedBefore: [],
clickedNow: [],
piecePlayerBlue: 12,
piecePlayerRed: 12,
winner: "",
player: null,
level: null
};
I want to save this state and recover it while playing a game using a button. I want to save it in local storage. How do I save everything in the map and recover it?