Standardizing our "export default" design pattern #545
Replies: 2 comments
-
We should use the direct I can see a situation where we might need another const before the Do we have a naming convention for the interface that defines the
|
Beta Was this translation helpful? Give feedback.
-
I prefer the second method of directly exporting the withTracker. As long as there is no underlying need for the withTracker to be assigned to a const, it is far easier to understand what is happening when the withTracker is directly exported. |
Beta Was this translation helpful? Give feedback.
-
When implementing React components that require a wrapping with withTracker(), our code often looks like this:
The problems with this approach are:
import FooContainer from 'Foo.tsx'
rather than our standard practice ofimport Foo from 'Foo.tsx'
In other cases, we don't define the ephemeral FooContainer variable at all:
This solves both of the above problems.
I think we should standardize on one of these approaches.
Question: are there any compelling reasons to prefer the first pattern over the second?
Proposal: if we prefer the second pattern, then let's create a good first issue to go through the code base and update it to get rid of the "*Container" declarations. (Or go through the code and add *Container declarations, if we decide that alternative is actually better.)
Beta Was this translation helpful? Give feedback.
All reactions