@@ -171,7 +171,7 @@ Atom.runtime.addGlobalLayer(
171171## Working with ` Stream ` s
172172
173173``` tsx
174- import { Result , Atom , useAtom } from " @effect-atom/atom-react"
174+ import { Atom , Result , useAtom } from " @effect-atom/atom-react"
175175import { Cause , Schedule , Stream } from " effect"
176176
177177// This will be a simple Atom that emits a incrementing number every second.
@@ -203,21 +203,21 @@ const countPullAtom = Atom.pull(Stream.make(1, 2, 3, 4, 5))
203203function CountPullAtomComponent() {
204204 const [result, pull] = useAtom (countPullAtom )
205205
206- return Result .match (result , {
207- onInitial : ( ) => <div >Loading...</div >,
208- onFailure : ( error ) => <div >Error: { Cause .pretty (error . cause )} </div >,
209- onSuccess : ( success ) => (
206+ return Result .builder (result )
207+ . onInitial (( ) => <div >Loading...</div >)
208+ . onFailure (( cause ) => <div >Error: { Cause .pretty (cause )} </div >)
209+ . onSuccess (({ items }, { waiting } ) => (
210210 <div >
211211 <ul >
212- { success . value . items .map ((item ) => (
212+ { items .map ((item ) => (
213213 <li key = { item } >{ item } </li >
214214 ))}
215215 </ul >
216216 <button onClick = { () => pull ()} >Load more</button >
217- { success . waiting ? <p >Loading more...</p > : <p >Loaded chunk</p >}
217+ { waiting ? <p >Loading more...</p > : <p >Loaded chunk</p >}
218218 </div >
219- ),
220- } )
219+ ))
220+ . render ( )
221221}
222222```
223223
0 commit comments