tj / frontend-boilerplate

webpack-react-redux-babel-autoprefixer-hmr-postcss-css-modules-rucksack-boilerplate (unmaintained, I don't use it anymore)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove prop type stuff

tj opened this issue · comments

nothing else has it so this is just a weird awkward way to add typing

You could use deku too http://dekujs.github.io/deku/, since we removed all that junk that React has. Main downside is that you lose all those React community toys. Hot reloading will work easier though.

I'll probably stick with react for the beginning and see how much third-party I end up actually using, if it's not a big factor then I'll check out the cleaner/smaller stuff. That'll give me a better idea of what else React handles too like the event normalization (apparently? haha) etc. Deku definitely looks way nicer in general!

While I don't think removing propType validation is necessarily a good idea, you could integrate something like flow for static type analysis.

IMO adding flow for a simple boilerplate is a little overkill—it really is only useful in big and complex apps. IIRC prop types are optional so it would not be a big deal to remove them—users will just decide whether to add them or not when they replace the boilerplate code with their own.

Yeah, you might be right on that one. But complex apps often start from boilerplates, so I guess it depends on the goal of this repo. propTypes are only checked in development mode too, removing them wouldn't really matter one way or another honestly. People will be writing their own components anyways.

Yeah, depends what @tj wants this to be. Might just be my opinion but almost every other boilerplate has too much stuff on it. That's great for "real" apps but the reason why I am interested in this one is that it looks pretty simple and perfect for weekend projects.

I don't plan on catering to anyone else's needs hahaha, just mine, but I figured someone else might want to use it too. I've barely touched front-end in the last two years too so having some community insight there is nice!

commented

propTypes is super useful in a real project. These checks caught many potential hours of bugs in my experience. I'd only remove them if I had similar guarantees from a stronger type system.

@gaearon totally, just feels hacky since it's the only thing type-enabled. I like the documentation aspect of it too but I dunno, weird me out a little.

commented

Props are the only way to pass data in React so as far as React is concerned it isn't worth checking anything else. I understand where you're coming from though, and this is why in the long term they are being phased out in favor of Flow—both internally at Facebook and externally. But Flow will take some more time to mature. In the meantime propTypes provide non-trivial value in React projects and can alone help you make complex refactorings without screwing up. Of course having tests is even better but consistently specifying propTypes goes a long way.