kuy / redux-tower

Saga powered routing engine for Redux app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support stateless functional components as a route action

kuy opened this issue · comments

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

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

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.

I have to prepare automated test for first release.

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

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.