/
githubmirror
/
solid
Обзор
Документация
Войти
/
githubmirror
/
solid
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/solid-ssr/examples/shared/src/components/Profile/index.js
30 строк
855 B
花果山大圣
add prettier code format in git-commit-hook (#1769)
27 июн 2023, 02:07
Не верифицирован
27 июн 2023, 02:07
e660e5a
Код
Авторство
О чём код?
import { createResource, lazy } from "solid-js"; const Profile = lazy(() => import("./Profile")); // this component lazy loads data and code in parallel export default () => { const [user] = createResource(() => { // simulate data loading console.log("LOAD USER"); return new Promise(res => { setTimeout(() => res({ firstName: "Jon", lastName: "Snow" }), 400); }); }), [info] = createResource( user, () => { // simulate cascading data loading console.log("LOAD INFO"); return new Promise(res => { setTimeout( () => res(["Something Interesting", "Something else you might care about", "Or maybe not"]), 400 ); }); }, { initialValue: [] } ); return <Profile user={user()} info={info()} />; };