Closed fahad19 closed 6 years ago
Depends on #6
I think that hoc
name can be improved. Higher order component is a term describing a way to organize code. It says nothing about it's functionality, so it's hard to get this aspect from naming. Besides, if there'll be two HOCs at some point, naming will become even less clear.
I would suggest wrapper
for a name. Which is not ideal, but I think it's better than hoc
. Maybe we can think of something that this thing does: it composes and provides all kind of props and creates a new component with them.
thanks @viacheslaff! I don't like the hoc
name either 😬
I remember @DzmitryKukharuk suggesting produce
.
IHMO, sound vague to me as well. I'm afraid we might not be able to get away with one word. I also think it should be a noun. What do you think of componentWithProps
or wrapperWithProps
or propsProvider
?
I am gonna stay away from the name provider
as much as possible for components. we already have a concept of "Providers" inside Apps. can lead to confusion in component layer.
True
Maybe we can think of injectProps
and then adjust with...
methods to fromProps
, fromStore
, fromDefault
etc.
It's a difficult thing to name this component. can't seem to be fully convinced with any of the suggestions by all of us combined :-/
the API of frint-props
is inspired by Recompose actually. and they popularized with*
functions (and higher-order components) in the React community.
according to the current state of master
branch, we are adopting a convention like this:
with
with
some ideas: capsule
, garment
, binder
, mantle
, canopy
is it gonna be too controversial to have a compose
higher-order component? 😬
import { compose } from 'frint-props';
import { compose } from 'frint-props-react';
Is there gonna be the case when those two are used in one file? I don't think there will be clashes. The use cases I see:
frint-props-react
uses frint-props/compose
frint-props/compose
and frint-props-react/compose
to wrap component@viacheslaff: that is correct, I don't see any clash of usage in a single module anywhere.
but that being said, I personally don't like using the name compose
across two packages either. but we also can't seem to find any suitable name yet.
this is the only blocker we have now for publishing to npm.
but that being said, I personally don't like using the name
compose
across two packages either.
But this is what packages are for.
The higher-order component will use
frint-react
'sobserve
internally:If there is a better name for the HoC, please suggest it here.
See usage example here: https://github.com/frintjs/frint-props#usage-with-react