Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hook support... #15

Open
babloo80 opened this issue Nov 18, 2018 · 1 comment
Open

hook support... #15

babloo80 opened this issue Nov 18, 2018 · 1 comment

Comments

@babloo80
Copy link

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

@babloo80
Copy link
Author

babloo80 commented Nov 19, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant