-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.tsx
40 lines (37 loc) · 1.04 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React from 'react';
import logo from './logo.svg';
import './App.css';
import { LCHost } from './LC';
import { MyChartComponent } from './Components/MyChartComponent';
function App() {
const data1 = genRandomData();
const data2 = genRandomData();
return (
// NOTE: LCHost should be defined at the top of component tree, before any and all LCJS based components
// This let's them share the same LC context for performance benefits.
<LCHost>
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<div className="chart">
<MyChartComponent data={data1} />
</div>
<div className="chart">
<MyChartComponent data={data2} />
</div>
</header>
</div>
</LCHost>
);
}
const genRandomData = () => {
const data = [];
let prev = 0;
for (let i = 0; i < 100_000; i += 1) {
const y = prev + (Math.random() * 2 - 1);
data.push(y);
prev = y;
}
return data;
};
export default App;