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

Support stateless functional components as a route action #9

Open
kuy opened this issue Dec 19, 2016 · 5 comments
Open

Support stateless functional components as a route action #9

kuy opened this issue Dec 19, 2016 · 5 comments
Labels

Comments

@kuy
Copy link
Owner

kuy commented Dec 19, 2016

The route definition accepts only Component or PureComponent because it uses isReactComponent to determine components or generators.

@rpunkfu
Copy link
Contributor

rpunkfu commented Dec 20, 2016

Is there any way to do so, expect checking if passed value is a function? I couldn't find any official method for it :)

@kuy
Copy link
Owner Author

kuy commented Dec 20, 2016

Yes, so I need to call a function and check a return value. If a function is a stateless functional component, it may return ReactElement. If not so, it's a saga. Anyway, we can execute it using call effect.

@kuy
Copy link
Owner Author

kuy commented Dec 20, 2016

I have to prepare automated test for first release.

@kuy kuy added the feature label Dec 20, 2016
@rpunkfu
Copy link
Contributor

rpunkfu commented Dec 20, 2016

Yup, tests would be cool, if you manage to choose & setup tools for testing, I would be happy to help in writing them :)

@kuy
Copy link
Owner Author

kuy commented Dec 26, 2016

I noticed that I can also use is-generator module to determine the value is a generator function or a normal function. typeof value.prototype.isReactComponent === 'undefined' && !isGeneratorFunction(value) is a stateless functional component.

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

No branches or pull requests

2 participants