Live data from Hacker News

Learn React by building a web app

udilia.com

91–100 of 107 posts

Re: Learn React by building a web app

#91
post #90

Earlier quoted context omitted.

I'll be honest and say that a lot of those concerns seem like things that Redux couldn't possibly have any solutions for. How can the core library tell you "what to name action creators" or "where to put connected components"? Those are style guide / app architecture concerns that are going to be specific to each team. FWIW, there _are_ a lot of chunks of reusable Redux-based logic out there (which I have listed in m…

> Those are style guide / app architecture concerns that are going to be specific to each team. Exactly, but it's Redux's fault that it actively adds like 5 new styleguide/app architecture concerns to worry about in your project! That is a bad thing about its fundamental design. For crying out loud, just put redux-thunk back in the core library. Nobody doesn't have async actions! One less thing to make a decision abo…

FWIW, I've put together a small "starter kit" lib that's intended to simplify some of the process around setting up a Redux store [0] . We do include redux-thunk by default there, as well as Immer for simplifying immutable updates in reducers. It's still a personal-scoped package atm, but longer-term we'd like to make it an official Redux-branded addon.

I'm serious about the request for a docs PR. I'll agree that our docs are currently a bit weak on "real-world" app architecture instructions. If you feel there's specific advice that should be in there, _please_ file a PR! I'm already swamped with other things on my task list, and simply don't have time to add major new sections to the docs myself right now. I keep begging the community for help improving the docs so we can make things better for everyone, and I have a bunch of open issues tagged "docs" I've been trying to get help with, yet we get almost zero actual meaningful contributions.

I'm not sure how HOCs vs render props "leads people to make poor design decisions".

The Redux team's main focus in the near future is figuring out how to update React-Redux to better work with the upcoming async React rendering capabilities [1]. We've got a couple open PRs atm, one that's trying to fix the "strict mode" warnings [2], and one I did a few weeks ago that experiments with using the new context API for better compatibility [3]. The immediate goal is to keep the public API the same to provide basic compatibility with async React behavior, but longer-term, we may have to rethink the API to fully take advantage of what React can do. We aren't planning to add a render props API right now, but that could be on the table for a v6 API change in the future.

Again, right now there's two primary maintainers: myself, and Tim Dorr. Both of us are doing this in our spare time, and there's only so much we can do. If you're using Redux, and you feel there's deficiencies in the docs or how it's being used, don't just complain - _please_ offer some help so the community can benefit!

[0] https://github.com/markerikson/redux-starter-kit

[1] https://github.com/reactjs/react-redux/issues/890

[2] https://github.com/reactjs/react-redux/pull/919

[3] https://github.com/reactjs/react-redux/pull/898

Re: Learn React by building a web app

#93
post #32

Earlier quoted context omitted.

I feel this way about React but Redux seems awkward and worthy of replacement. Am I in the minority on this?

I'm a Redux maintainer. Any particular pain points you're concerned about?

I am new to React and Redux so I might not have a well informed opinion. Also, I see the value of Redux and I use it in my projects.

But it's awkward setting up a global event handler with switch statements. And it seems like adding new functionality should require one step instead of three (updating a reducer file, updating an action file, and updating mapStateToProps).

It's like Redux operates on a different paradigm than Javascript and React. I do not think I'm knowledgeable enough to suggest any solutions.

Re: Learn React by building a web app

#94
post #93

Earlier quoted context omitted.

I'm a Redux maintainer. Any particular pain points you're concerned about?

I am new to React and Redux so I might not have a well informed opinion. Also, I see the value of Redux and I use it in my projects. But it's awkward setting up a global event handler with switch statements. And it seems like adding new functionality should require one step instead of three (updating a reducer file, updating an action file, and updating mapStateToProps). It's like Redux operates on a different paradi…

You might want to read Dan Abramov's post "You Might Not Need Redux" [0] and my own post "The Tao of Redux, Part 1 - Implementation and Intent" [1] to better understand the tradeoffs involved.

[0] https://medium.com/@dan_abramov/you-might-not-need-redux-be4...

[1] http://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao...

Re: Learn React by building a web app

#95
post #90

Earlier quoted context omitted.

> Those are style guide / app architecture concerns that are going to be specific to each team. Exactly, but it's Redux's fault that it actively adds like 5 new styleguide/app architecture concerns to worry about in your project! That is a bad thing about its fundamental design. For crying out loud, just put redux-thunk back in the core library. Nobody doesn't have async actions! One less thing to make a decision abo…

FWIW, I've put together a small "starter kit" lib that's intended to simplify some of the process around setting up a Redux store [0] . We do include redux-thunk by default there, as well as Immer for simplifying immutable updates in reducers. It's still a personal-scoped package atm, but longer-term we'd like to make it an official Redux-branded addon. I'm serious about the request for a docs PR. I'll agree that our…

> I'm not sure how HOCs vs render props "leads people to make poor design decisions".

This surprises me.

A render prop doesn't force any particular component interface. You just get a function and do whatever you want with the arguments (including just passing them along as props to another component, if you want).

HOCs force all the stuff you want to pull out of state to be passed as props, even if those props are not the ideal interface for the component you're wrapping, and they output a new component that you have to use instead of the original. Combined with derived state like reselect, this can lead to very weird component props that you'd never even consider if you were just designing a dumb-component without consideration for Redux.

Re: Learn React by building a web app

#96
post #95

Earlier quoted context omitted.

FWIW, I've put together a small "starter kit" lib that's intended to simplify some of the process around setting up a Redux store [0] . We do include redux-thunk by default there, as well as Immer for simplifying immutable updates in reducers. It's still a personal-scoped package atm, but longer-term we'd like to make it an official Redux-branded addon. I'm serious about the request for a docs PR. I'll agree that our…

> I'm not sure how HOCs vs render props "leads people to make poor design decisions". This surprises me. A render prop doesn't force any particular component interface. You just get a function and do whatever you want with the arguments (including just passing them along as props to another component, if you want). HOCs force all the stuff you want to pull out of state to be passed as props, even if those props are n…

Honestly, I've never used render props yet myself, for a variety of reasons, so I just don't have the experience to understand your concerns there.

As I said: if you have specific concerns that you think can be resolved by changes in the docs or the Redux/React-Redux libraries, please file an issue so we can discuss them in more detail.

Re: Learn React by building a web app

#97

The number one thing I’d like to strengthen is the process of building a react component for publishing on NPM. It’s way different from building something with create-react-app. I need a solution that has zero config, has HMR, the latest JavaScript and automatic deployment for demos on github pages. I have so many components I could publish, but just can’t be bothered to figure this out.

Extracted boilerplate from some of my libs:

https://github.com/alexkrolick/react-lib-quickstart

Want to port this to a CLI eventually, too

Re: Learn React by building a web app

#98

Not a single lesson titled: "How to write tests" With snapshots, while not perfect, they do catch a lot and are easy to do (and more importantly, easy to update when things change). React components are relatively easy to further test with enzyme and jest. Without a focus on instructing people how to do testing, people never bother.

I’ve been through a few “intro to react” courses like this now, and I have not come across a single one that talks about testing at any length, which seems insane to me. When I was learning Rails many years ago, test-driven development was all the rage. React, with it’s declarative approach, stateless components, immutable state, etc. seems purpose-built for testability. TDD with React should be ridiculously easy, bu…

Here's one: https://medium.com/@mbaranovski/quick-guide-to-tdd-in-react-...

Re: Learn React by building a web app

#99
post #51

Earlier quoted context omitted.

I'm a Redux maintainer. Any particular pain points you're concerned about?

Not OP, but my day to day job is helping teams with their migration onto React (often for big sites you've used or have at least heard of). Here goes, although these probably aren't anything new to you: – As far as I understand, Redux was intentionally made to be low-level and unopinionated, with the idea that other libraries would build on top of it. That has not really borne out and it actively makes adoption extre…

The real irony of redux is that most of the project specific customization has to do with dealing with the boilerplate
Post reply on HN