-
- {JSON.stringify(persistedState, null, 2)}
-
- );
- }
-}
diff --git a/src/plugins/rn-tic-tac-toe/index.tsx b/src/plugins/rn-tic-tac-toe/index.tsx
new file mode 100644
index 000000000..755e88179
--- /dev/null
+++ b/src/plugins/rn-tic-tac-toe/index.tsx
@@ -0,0 +1,190 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @format
+ */
+
+import React from 'react';
+import {
+ FlipperPlugin,
+ RoundedSection,
+ Button,
+ produce,
+ CenteredView,
+ Info,
+ colors,
+ styled,
+ FlexRow,
+ Text,
+ brandColors,
+} from 'flipper';
+import {Draft} from 'immer';
+
+type Player = ' ' | 'X' | 'O';
+
+type State = {
+ cells: readonly [
+ Player,
+ Player,
+ Player,
+ Player,
+ Player,
+ Player,
+ Player,
+ Player,
+ Player,
+ ];
+ winner: Player;
+ turn: 'X' | 'O';
+};
+
+function initialState(): State {
+ return {
+ // Cells
+ // 0 1 2
+ // 3 4 5
+ // 6 7 8
+ cells: [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '] as const,
+ turn: Math.random() < 0.5 ? 'O' : 'X',
+ winner: ' ',
+ } as const;
+}
+
+const computeNextState = produce(
+ (draft: Draft