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

Ability to subscribe using React Hooks #19

Closed
wants to merge 7 commits into from
Closed

Conversation

nxsyed
Copy link

@nxsyed nxsyed commented Feb 7, 2019

No description provided.

@pubnub pubnub deleted a comment Feb 7, 2019
@pubnub pubnub deleted a comment Feb 7, 2019
Copy link
Contributor

@ManuelFernando ManuelFernando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t understand very what you try to do according with official documentation in react

@nxsyed
Copy link
Author

nxsyed commented Feb 7, 2019

React hooks lets developers use state without creating a class component. Our SDK currently relies on component state to be able to add / change messages. I just added a condition to check for the new functional components that access state without being a stateful component

https://reactjs.org/docs/hooks-intro.html

@ManuelFernando
Copy link
Contributor

@nxsyed I understand about react hooks but I don’t understand well you change
var component = {setState: component, state:{}};

you’re declaring a variable which comes like a parameter

@nxsyed
Copy link
Author

nxsyed commented Feb 7, 2019

I didn't want to change too much of the code to add the feature - if the developer happens to pass in a functional component the component variable would break the app. I'm just adding the properties the function expects.

I'm curious if you have a different solution?

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

Successfully merging this pull request may close these issues.

4 participants