import React, { useCallback, useEffect, useState } from 'react' import { Table, TableColumn, Loading, Button } from 'react-icecream' const records = [ { name: 'default.sys', doing: 1, waiting: 2 }, { name: 'zenas', doing: 3, waiting: 1 }, { name: 'test', doing: 0, waiting: 0 } ] export default function Demo() { const [loading, setLoading] = useState(false) const mockGetData = useCallback(() => { setLoading(true) setTimeout(() => setLoading(false), 3000) }, []) useEffect(() => { mockGetData() }, [mockGetData]) return ( <> { if (loading && index === 0) { return records.length } }} render={val => (loading ? : val)} /> { if (loading && index === 0) { return records.length } }} render={val => (loading ? : val)} />
{ if (index === 0) { return 2 } }} /> { if (index === 0) { return 1 } if (index === 1) { return 2 } }} />
) }