0.1.5 • Published 6 years ago

@germtf/react-json v0.1.5

Weekly downloads
-
License
-
Repository
-
Last release
6 years ago

ReactJSON

This repository has a reconciler to convert React trees to JSON.

const Player = () => {
  return (
    <player>
      <life>20</life>
      <mana>20</mana>
    </player>
  );
};

const State = () => {
  return (
    <state>
      <Player />
      <Player />
    </state>
  );
};

const root = {};

ReactJSON.mount(<State />, root);

console.log(root);

// {
//   "children": [
//     {
//       "type": "state",
//       "children": [
//         {
//           "type": "player",
//           "children": [
//             {
//               "type": "life",
//               "children": [
//                 {
//                   "type": "text",
//                   "value": "20"
//                 }
//               ]
//             },
//             {
//               "type": "mana",
//               "children": [
//                 {
//                   "type": "text",
//                   "value": "20"
//                 }
//               ]
//             }
//           ]
//         },
//         {
//           "type": "player",
//           "children": [
//             {
//               "type": "life",
//               "children": [
//                 {
//                   "type": "text",
//                   "value": "20"
//                 }
//               ]
//             },
//             {
//               "type": "mana",
//               "children": [
//                 {
//                   "type": "text",
//                   "value": "20"
//                 }
//               ]
//             }
//           ]
//         }
//       ]
//     }
//   ]
// }
0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago