r/reactjs • • Jan 25 '20

Is there any tutorial that shows someone fixing up a badly written React app?

I feel you can learn more by watching someone fix up an application rather than building it from the ground up. Is there any tutorial like that?

127 Upvotes

39 comments sorted by

View all comments

224

u/FraserHamiltonDev Jan 25 '20

If anyone’s interested in making this kind of content you’ll find plenty of badly written react apps on my GitHub

32

u/2020-2050_SHTF Jan 25 '20

The scary thing is that I have no idea how bad my app is, but I have a feeling it's pretty bad.

It would be great if you could submit a GitHub link and get your code rated.

29

u/FraserHamiltonDev Jan 25 '20

Trying looking on GitHub at some bigger and more established projects to get a general idea.

The truth is that you’ll always look back at code you wrote 2 months ago and probably think it’s terrible, such is the curse of the coder we aim to continually learn and continually improve.

Or if you see bad code simply perform this Jedi mind trick; conclude that one of your team members must of wrote it

15

u/Jaich Jan 25 '20

Ah yes, I do this Jedi mind trick all the time on my solo projects.

3

u/ElllGeeEmm Jan 25 '20

How is it the fault of present me that past me was a stupid dum dum who made bad decisions?

3

u/acemarke Jan 25 '20

We do actually have a #code-review channel over in Reactiflux (https://www.reactiflux.com ). Might want to drop by there and ask for feedback.

2

u/OutsourcedToRobots Jan 25 '20

What makes you think its bad?

5

u/2020-2050_SHTF Jan 25 '20

As a long term unemployed coder, I generally have a low opinion of myself, my abilities, and my future as a web developer.

10

u/Slapbox Jan 25 '20

Try to extract yourself from the equation. What's bad about your code.

  • Is is a messy tangle of calls that you don't feel you have a grasp on?
  • Is it poor variable naming conventions?
  • Is it trying to leverage sub-par solutions to do more than they were intended to rather than going back to the drawing board to rethink it?

There's a lot of ways to have bad code, but those are the big 3 I've found in my thousands of hours of coding, and the things I've spent many months fixing from my earlier days.

2

u/gonzofish Jan 25 '20

What’s your GitHub?

4

u/2020-2050_SHTF Jan 25 '20

3

u/dingdongfootballl Jan 25 '20

Your code looks fine my man. Well either that or mines shitty too.

0

u/rgrome0105 Jan 25 '20

I don’t recommend overusing Context/Provider, if what you want to have is to be able to change and persist state across components more easily, I think what you must be using is Redux or still use Context but instead of having a lot of states maybe just use a native reducer.

Also I’ve noticed that in some components you have

const { state1 } = useContext(Context)
const { state2 } = useContext(Context)

Instead I think it would be more readable as

const { state1, state2 } = useContext(Context)

0

u/emailscrewed Jan 25 '20

Do you have any example or you can link me to it?