import React from "react"; import Tracker from "@openreplay/tracker"; import axios from "axios"; import { userId, getTracker, store } from "./tracker"; import logo from "./logo.svg"; import "./App.css"; import { ColumnDef, flexRender, getCoreRowModel, useReactTable, } from "@tanstack/react-table"; const trackerEx = getTracker(); function App() { const [view, setView] = React.useState("main"); const [tracker, setTracker] = React.useState(); const [counter, setCounter] = React.useState(store.getState().value); const [data, setData] = React.useState(() => [...defaultData]); const [shouldRerender, setShould] = React.useState(false); const [sRen, setRen] = React.useState(true); const [sUrl, setURL] = React.useState(""); const rerender = React.useReducer(() => ({}), {})[1]; const [input, setInput] = React.useState(""); store.subscribe(() => setCounter(store.getState().value)); const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel(), }); const chasd = () => { data.forEach((i) => (i.age = Math.floor(Math.random() * 100))); console.log(data[0]); setData(data); rerender(); }; React.useEffect(() => { trackerEx.start().then((session) => { console.log(session); const url = trackerEx.getSessionURL(); setURL(url || ""); setTracker(trackerEx); }); }, []); React.useEffect(() => { const id = setInterval(() => shouldRerender && rerender(), 5000); return () => clearInterval(id); }, [rerender, shouldRerender]); if (!sRen) return (
test
); const testAPI = () => { fetch("https://pokeapi.co/api/v2/pokemon/ditto") .then((r) => r.json()) .then((p) => console.log(p)); }; const testAPIError = () => { fetch("https://pokeapi.co/api/v2/poakemon/ditto") .then((r) => r.json()) .then((p) => console.log(p)); }; const incrementRedux = () => { store.dispatch({ type: "counter/incremented" }); }; const redux2 = () => { store.dispatch({ type: "counter/test" }); }; const redux3 = () => { store.dispatch({ type: "counter/test2" }); }; const redux4 = () => { store.dispatch({ type: "counter/test3" }); }; const customEvent = () => { tracker?.event("test", "event"); }; const customError = () => { tracker?.handleError(new Error(), { testing: "stuff", taha: "is cool" }); }; const testJSError = () => { throw new Error("Im the error"); }; const axiosInst = axios.create(); const addAxios = () => { console.log("hull"); }; const testAxiosApi = () => { axiosInst("https://pokeapi.co/api/v2/pokemon/ditto").then((p) => console.log(p) ); }; return ( <> test link

{view} view
{view === "main" ? (
{/* */} logo Your userId is [{userId}] session url:{" "} {sUrl} setInput(e.target.value)} type="text" />
should not be seen here
obscured
masked deprecated
) : (
{table .getHeaderGroups() .map( (headerGroup: { id: React.Key | null | undefined; headers: any[]; }) => ( {headerGroup.headers.map( (header: { id: React.Key | null | undefined; isPlaceholder: any; column: { columnDef: { header: any } }; getContext: () => any; }) => ( ) )} ) )} {table .getRowModel() .rows.map( (row: { id: React.Key | null | undefined; getVisibleCells: () => any[]; }) => ( {row .getVisibleCells() .map( (cell: { id: React.Key | null | undefined; column: { columnDef: { cell: any } }; getContext: () => any; }) => ( ) )} ) )} {table .getFooterGroups() .map( (footerGroup: { id: React.Key | null | undefined; headers: any[]; }) => ( {footerGroup.headers.map( (header: { id: React.Key | null | undefined; isPlaceholder: any; column: { columnDef: { footer: any } }; getContext: () => any; }) => ( ) )} ) )}
{header.isPlaceholder ? null : flexRender( header.column.columnDef.header, header.getContext() )}
{flexRender( cell.column.columnDef.cell, cell.getContext() )}
{header.isPlaceholder ? null : flexRender( header.column.columnDef.footer, header.getContext() )}
{table .getHeaderGroups() .map( (headerGroup: { id: React.Key | null | undefined; headers: any[]; }) => ( {headerGroup.headers.map( (header: { id: React.Key | null | undefined; isPlaceholder: any; column: { columnDef: { header: any } }; getContext: () => any; }) => ( ) )} ) )} {table .getRowModel() .rows.map( (row: { id: React.Key | null | undefined; getVisibleCells: () => any[]; }) => ( {row .getVisibleCells() .map( (cell: { id: React.Key | null | undefined; column: { columnDef: { cell: any } }; getContext: () => any; }) => ( ) )} ) )} {table .getFooterGroups() .map( (footerGroup: { id: React.Key | null | undefined; headers: any[]; }) => ( {footerGroup.headers.map( (header: { id: React.Key | null | undefined; isPlaceholder: any; column: { columnDef: { footer: any } }; getContext: () => any; }) => ( ) )} ) )}
{header.isPlaceholder ? null : flexRender( header.column.columnDef.header, header.getContext() )}
{flexRender( cell.column.columnDef.cell, cell.getContext() )}
{header.isPlaceholder ? null : flexRender( header.column.columnDef.footer, header.getContext() )}
)}
); } export default App; type Person = { firstName: string; lastName: string; age: number; visits: number; status: string; progress: number; }; const defaultData: Person[] = [ { firstName: "tanner", lastName: "linsley", age: Math.floor(Math.random() * 100), visits: 100, status: "In Relationship", progress: 50, }, { firstName: "tandy", lastName: "miller", age: 40, visits: 40, status: "Single", progress: 80, }, { firstName: "joe", lastName: "dirte", age: 45, visits: 20, status: "Complicated", progress: 10, }, ]; const testArr = [...defaultData]; for (let i = 0; i < 30; i++) { defaultData.push(...testArr); } const columns: ColumnDef[] = [ { accessorKey: "firstName", cell: (info: { getValue: () => any }) => info.getValue(), footer: (info: { column: { id: any } }) => info.column.id, }, { accessorFn: (row: { lastName: any }) => row.lastName, id: "lastName", cell: (info: { getValue: () => | boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | null | undefined; }) => {info.getValue()}, header: () => Last Name, footer: (info: { column: { id: any } }) => info.column.id, }, { accessorKey: "age", header: () => "Age", footer: (info: { column: { id: any } }) => info.column.id, }, { accessorKey: "visits", header: () => Visits, footer: (info: { column: { id: any } }) => info.column.id, }, { accessorKey: "status", header: "Status", footer: (info: { column: { id: any } }) => info.column.id, }, { accessorKey: "progress", header: "Profile Progress", footer: (info: { column: { id: any } }) => info.column.id, }, ];