main
js 66 lines 1.33 KB
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 import * as React from 'react';
11 import Immutable from 'immutable';
12
13 const set = new Set(['abc', 123]);
14 const map = new Map([
15 ['name', 'Brian'],
16 ['food', 'sushi'],
17 ]);
18 const setOfSets = new Set([new Set(['a', 'b', 'c']), new Set([1, 2, 3])]);
19 const mapOfMaps = new Map([
20 ['first', map],
21 ['second', map],
22 ]);
23 const typedArray = Int8Array.from([100, -100, 0]);
24 const arrayBuffer = typedArray.buffer;
25 const dataView = new DataView(arrayBuffer);
26 const immutable = Immutable.fromJS({
27 a: [{hello: 'there'}, 'fixed', true],
28 b: 123,
29 c: {
30 '1': 'xyz',
31 xyz: 1,
32 },
33 });
34 const bigInt = BigInt(123);
35
36 class Foo {
37 flag = false;
38 object: Object = {
39 a: {b: {c: {d: 1}}},
40 };
41 }
42
43 export default function UnserializableProps(): React.Node {
44 return (
45 <ChildComponent
46 arrayBuffer={arrayBuffer}
47 dataView={dataView}
48 map={map}
49 set={set}
50 mapOfMaps={mapOfMaps}
51 setOfSets={setOfSets}
52 typedArray={typedArray}
53 immutable={immutable}
54 bigInt={bigInt}
55 classInstance={new Foo()}
56 />
57 );
58 }
59
60 function ChildComponent(props: any) {
61 return (
62 <>
63 <div>{props.bigInt}</div>
64 </>
65 );
66 }