-
Notifications
You must be signed in to change notification settings - Fork 164
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
React Hooks v16.8 #121
React Hooks v16.8 #121
Conversation
@JsName("useReducer") | ||
external fun <S, A> rawUseReducer(reducer: RReducer<S, A>, initialState: S): RDependenciesArray | ||
@JsName("useReducer") | ||
external fun <S, A> rawUseReducer(reducer: RReducer<S, A>, initialState: S, initialAction: A): RDependenciesArray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use initialAction: A = definedExternally
and avoid duplicating the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't sure that it's equal in converted js. And this "optimisation" is unnecessary.
Hooks should only be defined inside a functional component body, so it's better to define them as extension functions on
|
/** | ||
* Get functional component from [func] | ||
*/ | ||
fun <P : RProps> functionalComponent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrappers for react hooks and way to create functional component like this