Open sbyeol3 opened 2 years ago
"Great User Experience"
Suspense
React.lazy
Reading the data
Specifying the loading state
if (isLoading) return <Spinner />; return (...); // declarative way ! <Suspense fallback={<Spinner />}> <List pageId={pageId} /> </Suspese>
"design centric idea"
Concurrent Redering : "A behind-the-scenes capability in React that powers features like Suspense"
"what์ ์ง์คํ๋ผ, React๋ how์ ์ง์คํ๋ค . . "
Xuan Huang
function TodoList({ visibility, themeColor }) { const [todos, setTodos] = useState(initialTodos); const handleChange = todo => setTodos(todos => getUpdated(todos, todo)); const filtered = getFiltered(todos, visibility); return ( <div> <ul> {filtered.map(todo => ( <Todo key={todo.id} todo={todo} onChange={handleChange} /> ))} </ul> <AddTodo setTodos={setTodos} themeColor={themeColor} /> </div> ); }
function TodoList({ visibility, themeColor }) { const [todos, setTodos] = useState(initialTodos) let hasVisibilityChanged, hasThemeColorChanged, hasTodosChanged, memoCache if (hasVisibilityChanged || hasThemeColorChanged || hasTodosChanged) { const handleChange = memoCache[0] || (memoCache[0] = (todo) => setTodos((todos) => getUpdated(todos, todo))) let filtered, jsx_todos if (hasVisibilityChanged || hasTodosChanged) { filtered = memoCache[1] = getFiltered(todos, visibility) jsx_todos = memoCache[2] = ( <ul> {filtered.map((todo) => ( <Todo key={todo.id} todo={todo} onChange={handleChange} /> ))} </ul> ) } else { filtered = memoCache[1] jsx_todos = memoCache[2] } } const jsx_addTodo = hasThemeColorChanged ? (memoCache[3] = <AddTodo setTodos={setTodos} themeColor={themeColor} />) : memoCache[3] return ( <div> {jsx_todos} {jsx_addTodo} </div> ) }
Daishi Kato
props
context
useState
useReducer
useSyncExternalStore
subscribe
getSnapshot
Tafu Nakazaki (SmartHR)
์ฐธ๊ณ
It's a mechanism for data fetching libraries to communicate to React that the data a component is reading is not ready yet
First Block ๐
Keynote
Suspense
Suspense
๋ client์์React.lazy
๋ฅผ ์ด์ฉํ์ฌ ์ฝ๋๋ฅผ ๋์ ์ผ๋ก ๋ก๋ฉํ๋ ๊ฒฝ์ฐ์ ์ฅ์ ์ด ์์์Reading the data
+Specifying the loading state
"design centric idea"
React.lazy
Concurrent Redering : "A behind-the-scenes capability in React that powers features like Suspense"
"what์ ์ง์คํ๋ผ, React๋ how์ ์ง์คํ๋ค . . "
React without memo
React Forget
example code
Final Block
React 18 for External Store Libraries
props
context
useState
useReducer
useSyncExternalStore
: React 18์์ ๋์useSyncExternalStore
subscribe
: get callback, return unsubscribe funcgetSnapshot
: return immutable valueAccessible Japanese Form Components with React