News for hackers. Stuff that matters.
Re:React Router v4 FAQ by jasim on Friday September 16, 2016 @02:07AM (#12512173)
Routing stateful apps using string URLs is not a solved problem. Which thick-client app gives you a universally shareable string that restores it to a specific predictable state? How is it even possible? It took a confluence of web technologies, however ill-wrought, to make that possible today.

No one has yet figured out a clean abstraction that solves this - yes it is hard to imagine that we still have new problems that were not solved in the 1960s by the Greats. This is not a computer science-y problem; it falls into the spectrum of craft and art than science. It'll be beautiful when it is framed correctly and an elegant solution comes out. From the looks of it, the authors of this library (along with the rest of the client-side router ecosystems) are the closest.

The FAQ satisfactorily answers why they are trying this approach - React brought the concept of 'mounting' UI elements, and it applies equally well to routing as well.

I do share the pain of having to keep up with a changing API; and it is especially biting when it feels gratuitous (which I think is not at all the case here), but let's chalk it up to the cost of being in the bleeding edge, working in one of the most well-paid professions in the world.

Re:React Router v4 FAQ by connorelsea on Friday September 16, 2016 @02:18AM (#12512210)
This is a really logical and thought out response. The evolution with React Router isn't meaningless. It's simply good people trying (and succeeding imo) to innovate and create good, well-formed software.

JavaScript as a language has a lot of churn, and many times unnecessarily, but there is nuance.

Re:React Router v4 FAQ by zachrose on Friday September 16, 2016 @01:07PM (#12515491)
> Routing stateful apps using string URLs is not a solved problem. Which thick-client app gives you a universally shareable string that restores it to a specific predictable state?

Google Maps seems to have solved a version of this problem. There is a unique URL for every position and oriention of your view of the world, including street view.

But even then it doesn't log you in as the user who sent you the link. (That would be crazy.) The link will probably also not include any user-specific display preferences. If Google Maps had a "kilometers from you" widget in the corner, you would not expect that value to be reconstructed from the URL.

So really URLs are not keys to the entire state of the app. They represent a "location" which is both abstract and very specific to the application.

Personally I think of the URL as just another input to the state of the application, really not that different from user events, HTTP responses, etc.

Re:React Router v4 FAQ by sangnoir on Friday September 16, 2016 @11:20AM (#12514595)
> but let's chalk it up to the cost of being in the bleeding edge, working in one of the most well-paid professions in the world

Slightly off-topic, but I have observed that front-end engineering posts seems to have lower salaries compared to back-end engineering posts for the same level of seniority. My working theory is that there is a higher supply of front-end devs - most of the self-taught devs I've encountered work on the front-end (Flash -> HTML/Javascript, or Designer -> dev).

Re:React Router v4 FAQ by sotojuan on Friday September 16, 2016 @12:11PM (#12515017)
It all depends where you live and what is considered front end or web developer. In NYC if frontends get paid less it's only $10k less at most. They're still making up to six figures with less than ten years of experience.
Re:React Router v4 FAQ by ChrisCinelli on Friday September 16, 2016 @02:21AM (#12512216)
The only API that works well and give you all the flexibility is the one that the browser exposes. If you stick to something that is close to how the browser behaves, you should be fine.

In the React ecosystem I have seen that people sometimes want to abstract too much with no real pragmatic advantages. The result is that the abstraction become verbose to use and get in the way for coding things that produce a better user experience. Things that used to be simple to build.

Keep it simple. Make it more complex only when it is necessary.

Re:React Router v4 FAQ by jasim on Friday September 16, 2016 @02:25AM (#12512227)
All fair points, but we still have the problem of giving our users a URL to our rich web app which can take them into a node inside a nested state hierarchy. And not all applications can be purely server-side. You can't for example build a spreadsheet on the web as a series of request-responses.
[dead]
Re:React Router v4 FAQ by corecoder on Friday September 16, 2016 @05:49AM (#12512876)
You can favorite a comment and keep track of it without spamming.
Re:React Router v4 FAQ by mstade on Friday September 16, 2016 @07:53AM (#12513362)
I couldn't find the favorite link on mobile though :o(
Re:React Router v4 FAQ by adregan on Friday September 16, 2016 @08:38AM (#12513562)
It's not super intuitive, but to favorite a comment: "click on its timestamp to go to its page, then click 'favorite' at the top."
Re:React Router v4 FAQ by mstade on Tuesday September 20, 2016 @06:48PM (#12544034)
Oh hey, thanks chief!