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

Maintain static functions #53

Closed
erikras opened this issue Aug 12, 2015 · 10 comments
Closed

Maintain static functions #53

erikras opened this issue Aug 12, 2015 · 10 comments

Comments

@erikras
Copy link
Contributor

erikras commented Aug 12, 2015

Could connect() check its wrapped component for static functions and add them to the returned component? For things like fetchData() and onEnter(). Seems like it would be pretty easy to go through the keys and check if typeof WrappedComponent[key] === 'function'.

Just a thought.

@gaearon
Copy link
Contributor

gaearon commented Aug 12, 2015

I wouldn't do that. It's only going to make things worse IMO: acdlite/flummox#173 (comment)

@gaearon gaearon closed this as completed Aug 12, 2015
@erikras
Copy link
Contributor Author

erikras commented Aug 12, 2015

Good call. I briefly looked into implementing it and the code disgusted me.

@gaearon
Copy link
Contributor

gaearon commented Sep 27, 2015

I'm happy to reconsider it using https://github.com/mridgway/hoist-non-react-statics since we don't have to maintain it. Wanna make a PR?

@gaearon gaearon reopened this Sep 27, 2015
@erikras
Copy link
Contributor Author

erikras commented Sep 27, 2015

I was going to complain about the lack of docs for that library, but then I saw how utterly trivial the code is. Also, I can't remember the time I last used the word "hoist"; such a good word.

Will add the PR to the todo list.

@erikras
Copy link
Contributor Author

erikras commented Sep 30, 2015

I just, by chance, ran into a problem in my app where I need this functionality. Any chance of a release soon?

@gaearon
Copy link
Contributor

gaearon commented Sep 30, 2015

Give me a few days, vacation :-)

@esamattis
Copy link
Contributor

If in hurry you can do it in userland:

MyComponentConnected = hoistNonReactStatics(connect(mapState)(MyComponent), MyComponent);

It should be future compatible.

@erikras
Copy link
Contributor Author

erikras commented Sep 30, 2015

You and your pink crocs enjoy your vacation. No hurry. 🐚 🌊 ☀️

For now I've just done MyComponent.WrappedComponent.onEnter to get to my onEnter function.

@gaearon
Copy link
Contributor

gaearon commented Oct 5, 2015

Out in 3.1.0.

@gaearon
Copy link
Contributor

gaearon commented Mar 5, 2016

Lol. I knew this is going to come back and bite me in the arse.
#163 (comment)

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

3 participants