gothinkster / react-redux-realworld-example-app

Exemplary real world application built with React + Redux
https://react-redux.realworld.io
MIT License
5.57k stars 2.51k forks source link

One more feature #1

Closed nvartolomei closed 8 years ago

nvartolomei commented 8 years ago

Also I would like to see here an example of displaying a sidebar with latest posts, or featured posts. Implemented with a multireducer or something like that.

Also maybe something like displaying recent comments, or on homepage show comments for each post.

I think this is great fit for using advanced patterns section.

FKAJerry commented 8 years ago

i wanna see code without ugly action type constant, without ugly switch

LubergAlexander commented 8 years ago

@hermaproditus https://github.com/acdlite/redux-actions

FKAJerry commented 8 years ago

@LubergAlexander to be honest, redux-actions solution is less than satisfactory, if your using alt before

alexeygolev commented 8 years ago

@hermaproditus I don't find type constants or switches ugly. In fact I think it's as close to pattern matching as we can get without building too many abstractions. You can always abstract them away if you need it. Not that anybody is stopping you from doing so. I tried several abstraction methods and ended up just using constants and switch blocks. It's clear and easy to debug. I guess the point I want to make is it's really a matter of preference. As far as I understand the point of this repo is to show some advanced use cases in the most general way. Abstractions you can build on top of it are up to you.

EricSimons commented 8 years ago

Agreed with all of @alexeygolev points! Closing this for now, happy to talk more about this if need be though.

nvartolomei commented 8 years ago

@EricSimons have you read issue text?

mxstbr commented 8 years ago

I agree completely with @alexeygolev, the code style should be of no concern for this repo. The one chosen is used by the official Redux examples to.

This issue shouldn't be closed though, since the original question by @nvartolomei wasn't related to that at all!

EricSimons commented 8 years ago

Oops, I viewed this on mobile and missed the initial comments - I screwed up! It looks like you've had a good look at the codebase already @nvartolomei (editor race condition, etc) -- do you think the current functionality lacks the sort of info you're looking for? i.e. we already have comment population, showing latest articles, etc

nvartolomei commented 8 years ago

@EricSimons I was looking for a case where you have 2 views for articles on the same page, for example the home view like it is now, and a widget with popular articles in a sidebar, under popular tags.

I'm wondering how would you implement an article list reducer and how would you reuse it.

cc @gaearon

vkarpov15 commented 8 years ago

I think we already have an article list component and corresponding reducers, are those not sufficient?