Writing Clean and Concise React Components by Making Full Use of ES6/7 Features and the Container…
Josh J
28010

How is double type checking a good thing? You have to define the same type defs in 2 places (or every container that uses the dumb component). When the dumb component changes, now you have several different places to update instead of just the component that changed.

One can do something like this :

type ContainerProps = {

dumbComponent1: Object,

dumbComponent2: Object,

}

type DumbComponent1Props = {

propA: string,

propB: int,

}

but this still feels superfluous, redundant and wrong.

You can also abstract Dumb component types into a file and share that, but again, why should one be forced to check types in 2 (or more places)?

Barring this one (albeit big) annoyance, I think the Container pattern is really good.

Show your support

Clapping shows how much you appreciated Hrusikesh Panda’s story.