10up / Engineering-Best-Practices

10up Engineering Best Practices
https://10up.github.io/Engineering-Best-Practices/
MIT License
756 stars 206 forks source link

Improvements and Suggestions for React Best Practices #267

Open ivankruchkoff opened 5 years ago

ivankruchkoff commented 5 years ago

I'm looking through the React documentation, and it reads more like:

Here are some terms related to React that you should further research, rather than here are some DOs and DONTs for React.

Here are some things that may make sense to cover:

tlovett1 commented 5 years ago

@ivankruchkoff I agree we could touch on some of these topics better. Maybe you can work on a PR collaborating with @timwright12 ?

MatthewEppelsheimer commented 5 years ago

I generally agree there isn't much value in this as it currently stands. Being still quite new to React myself, I didn't find here what I generally expect from our best practices, which is definitive guidance.

I also don't think it's a good idea to suggest building the components without a router first, it's easier to change routes than to add a router mid project.

I completely agree with this. Deferring thinking about routing sounds like a fine practice if speed is the priority, but a poor way to architect a robust, stable application that's a pleasure for a retainer team to maintain for years after the build.

A few other things to possibly cover:

timwright12 commented 5 years ago

One thing that's important to remember in this document is that we're not replicating the normal React docs and it shouldn't be a React tutorial, it's more so how React is generally integrated into common projects at 10up. However, it would be great to see some PRs and improvements now that we've worked on a lot more React projects @ivankristianto @MatthewEppelsheimer

dainelmawer commented 5 years ago

@timwright12 I think @ivankruchkoff points out some pretty valid points here. The above points generally come out in code reviews, especially elements like PropTypes, PureComponents, Stateless Functional Components - a lot of green engineers to React wouldn't be able to deduce from the React docs the correct application/context of these concepts without some on-the-ground experience of working on React projects. I'll add some PR's today that would address some of these

dkoo commented 5 years ago

Agree with the above. I definitely think this page warrants another look, especially after recent convos about the various routers people have used across projects, as well as the new Hooks and Context APIs. Paging @magnificode as this might relate to ongoing efforts on the React project scaffold.

magnificode commented 5 years ago

@timwright12 @dkoo I'll be taking a look at this today. Going to reformat our approach to state management (including some Context documentation), and make some updated recommendations around Routing.