justinl-y / red-it

A full-stack web-application replicating Reddit and using React, Redux, Express and PostgreSQL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redit Pt. 1 issues

BlakeTurner opened this issue · comments

General:

I like that you've broken up your Redux code by component rather than by reducer/action/store. This is much more scalable (in my opinion). That said, within to context of the component you can still separate your actions and reducers.

Keep working. You're very close in a lot of places. When refactoring, focus on the simplest possible ways of doing what you need to do, and focus on readability. I can tell that a lot of the concepts have nearly solidified in your hear. Just keep pounding away.

Specifics:

https://github.com/justinl-y/REDit/blob/master/web.browser/src/components/NewPost/index.js#L11
I love how you're accessing your styles here. Well done.

https://github.com/justinl-y/REDit/blob/master/web.browser/src/components/NewPost/index.js#L23
Remove unused code

https://github.com/justinl-y/REDit/blob/master/web.browser/src/components/NewPost/index.js#L49
Prefer leveraging CSS display properties over repeated used if <br>

https://github.com/justinl-y/REDit/blob/master/web.browser/src/components/Post/index.js#L27
I recommend extracting this function and putting it outside of your jsx. It's nearly impossible to read.

https://github.com/justinl-y/REDit/blob/master/web.browser/src/components/Week/index.js#L22
I'm seeing this e.preventDefault popping up in several places. It would make more sense inside the event handler itself.

https://github.com/justinl-y/REDit/blob/master/web.browser/src/components/Week/index.js#L43
https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/App/index.js#L22
https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/Categories/actions.js#L17
https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/PostList/actions.js#L98
https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/redux.js#L9
Kill unused code

https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/Categories/actions.js#L3
Yup!

https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/CreatePost/index.js#L6
This is a very clean way of separating your output from the render function. Take it one step further, call it menuItems. That way no one can ever confuse what it it.

https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/PostList/actions.js#L79
What the devil is going on with your indentation here?

https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/PostList/actions.js#L34
Food for thought: it's difficult to test whether an object is empty in JS. So maybe an empty object isn't a good default. I would recommend null. Then you could do something like:

if (action.payload) 
  // Do something

https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/PostList/actions.js#L48
The action pattern we're using is called Flux Standard Actions. Make sure you have a payload property, even if it's null.

https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/PostList/actions.js#L87
I don't think you need the some function here.

https://github.com/justinl-y/REDit/blob/master/web.browser/src/containers/PostList/index.js#L8
This should be a functional stateless component