The whole purpose of propTypes is to help us during development: they don't add any actual functionality to our code. And, for that reason, some people remove the propTypes code when they build their assets for production. It's not a big deal, it just makes your final JS files a little bit smaller.

This is totally optional, but let's do it real quick! Google for "babel-plugin-transform-react-remove-prop-types". Wow! First prize for longest name!

This is a Babel plugin that can remove propTypes. Copy the library name, find your terminal, and get it!

yarn add babel-plugin-transform-react-remove-prop-types --dev

While that's downloading, go back to its docs. Usually, this is configured via a .babelrc file: this activates the plugin on the production environment. Except, because we're using Webpack Encore, it handles the Babel configuration for us.

Fortunately, Encore gives us a hook to modify that config. Add .configureBabel() and pass this a function with one arg: call it babelConfig. Now, when Encore builds, it will create our Babel configuration, then call this function so we can modify it. We need to add a new env key, with this config below it. Copy the production, plugins part. Then, add babelConfig.env = and paste. This is safe because, if you logged the babelConfig object, you would see that Encore doesn't include an env key. So, we're not overriding anything.

Oh wait, actually, I made a mistake! This totally won't work! That's because we can't rely on Babel to know whether or not we're creating our production build. Instead, use if Encore.isProduction(). Then, inside, add the plugin with babelConfig.plugins.push(), copy the plugin name, and paste!