This pull request takes the changes from #12 one step further, by adding a final new variant of withStyles for function components, and deprecating childWithStyles and replacing it in all the samples.
Motivation: the childWithStyles variants always create a new component on each invocation, which prevents reconciliation of such components.
Instead, withStyles should be used to store the created higher order component in a RClass variable and call that to render the component.
This is also more similar to the original React API naming.
As a nice side-effect, this makes it much nicer to pass the styles directly to the withStyles function (see samples), which allows to omit the StyleSets.() -> Unit signature.
This pull request takes the changes from #12 one step further, by adding a final new variant of withStyles for function components, and deprecating childWithStyles and replacing it in all the samples.
Motivation: the childWithStyles variants always create a new component on each invocation, which prevents reconciliation of such components.
Instead, withStyles should be used to store the created higher order component in a RClass variable and call that to render the component.
This is also more similar to the original React API naming.
As a nice side-effect, this makes it much nicer to pass the styles directly to the withStyles function (see samples), which allows to omit the
StyleSets.() -> Unit
signature.