OperationXen / cyberpunkCTF

A CTF framework built on python using django, graphql and react
GNU General Public License v3.0
1 stars 0 forks source link

Code review #25

Closed mikeyhogarth closed 5 years ago

mikeyhogarth commented 5 years ago

Did a quick code review, the advice here please feel free to either take or ditch, i had 10 mins spare and thought I'd take a look. Some comments are in-line, but in addition;

The good

The bad

Your State management solution

It means that when you are wondering about the logic of your app, say, logging someone in/out, you don't need to worry about which component that happens in because you know it's just going to be in a single reducer somewhere.

With your current setup, consider this: Imagine you wanted another logout button somewhere, or you wanted a certain action to force a logout. As you have it now, you'd need to extract that logic somewhere and re-implement your context stuff in the new place.

Using reducer/dispatch, you just dispatch a logout action.

OperationXen commented 5 years ago

Thanks for the review mate, I'm going to go through it line by line, but it looks like I need to read up on redux to handle the process of shuffling around actions as I accept totally your argument around the additional logout functionality example.

This "state maze" seems very much like a common issue with react apps, at least as I've been designing this one so I'm glad there's an accepted solution! As with react I'm going to go read the docs first...