react-streams
react-streams copied to clipboard
hook support...
Hello there,
I am trying to use react-streams
with upcoming hooks
from react. And I am seeing some issues.
Here is what I am trying to do...
import React, {useContext} from 'react'
import {streamProps} from 'react-streams'
import {Ctx} from './Ctx'
const Component2 = streamProps( (props$) => {
const ctx = useContext(Ctx)
//want to use the ctx along to help transform some stream values of props$
return props$
})
export default Component2
When the useContext
hook is invoked, I get TypeError: dispatcher.useContext is not a function
.
Please advice on what alternatives I have?
Thanks, Muthu
My bad. Had some issues with package.json. I can interoperate with useContext
.
But, I do have a question. Do I have any hooks to perform cleanup
like operation when the above Component2
goes thru an unmount process?
Also, I tried to use stream(source$, pipeOperation)
inside an streamProps
and attempted to combine streams (above stream and props$) did run into an error.
From https://youtu.be/voVU3G7Y39A?t=1030, it seems like the functions have changed.