Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
I'm about to give up on AngularJS, I'm going to try React
12 points by zappo2938 on Aug 25, 2016 | hide | past | favorite | 14 comments
My implementation is pretty vanilla AngularJS with ui-router. All I want is for a user to use forward and back browser buttons to navigate. It doesn't work. I can't find a solution through searching Google. What few blog posts and StackOverflow questions I can find are from 2013 and 2014.

I'm not going to spend a week figuring out how all the internals work so I can roll my own solution.

If going to spend a week on something, it will be working with React. And, I'll see where that goes.




> My implementation is pretty vanilla AngularJS with ui-router. All I want is for a user to use forward and back browser buttons to navigate

This really shouldn't be hard to get working. Try downloading a sample/example project that has routing set up already then strip it down to the bare minimum. Throwing a whole framework away because you're maybe missing a line of code somewhere isn't going to set a good trend.


After several hours I figured it out. My biggest problem was that I had the same sentiment as your comment in "because you're maybe missing a line of code." I kept blaming myself when it was a bug in a popular module one of only a handful I'm using.


Just remember you're in good company! I find a lot of coding involves you trying to do something, getting an error, you look up the error, you try the solution you find, you get a new error and so on. Many people will give up after a few hurdles.

I tried to port an Angular 1 to Angular 2 recently and fixing issues to do with just getting the JavaScript modules/files to load drove me up the wall. I was close to giving up but after working through several layers of issues it eventually worked. Sounds like it was an similar experience to you...there's so many permutations of JavaScript stacks you can use that isolating the issue is like finding a needle in a haystack sometimes. What I mean is that sometimes all you can do it be persistent and realise that switching to a new framework could just introduce lots of new issues.


Though I enjoy React, React (by itself) isn't a full MVC framework like Angular.

Before you throw out everything, try this: https://docs.angularjs.org/guide/$location


This is actually a helpful comment.

I've been working through $location and state change events. I've read and worked through every blog post and stack exchange question from the first three pages of the "angularjs $location" Google search results for the last 36 hours.

The browser address bar was flickering so I was wondering why that happened. It wasn't my code but I found the culprit.


React is a very nice UI view rendering lib, but that's pretty much all it does. Which isn't a bad thing at all, just something to bare in mind coming from Angular.

jsx is incredibly straightforward to read/write, and the actual time it takes to build anything is trivial, but if you drop a lot of es6 on it babel is going to output some moderately horrifying code when you dig into it.

Get your head around the component lifecycle stuff early and save yourself some O(n) heartache down the line.


If you are going to spend a week in angular for routing you will spend a month in react cause react is a view rendering lib. Just read the docs and for for http://angular.io (angular2) they have a hands on example


Did you try reading the ui-router docs?

https://github.com/angular-ui/ui-router/blob/master/README.m...

The "Nested States & Views" section of the README links to a full working demo on Plunker that does exactly what you want:

http://plnkr.co/edit/u18KQc?p=preview


If all you really need is a router, you should probably just use a router:

https://github.com/AmpersandJS/ampersand-router

I've personally used this router with in a React SPA, though you can use it with pretty much anything including something simple like jQuery or Knockout. If you don't want to use a module loader, then grabbing the original Backbone router is probably your best bet.


Good luck in React, there is a good learning material called "ReactJS Convention Book - ReactJS For Dummies: Why & How to Learn React Redux, the Right Way." - and it's 100% online at https://reactjs.co/


Do it! React is way better.


?


Vuejs is what you really want


I personally recommend a vanilla front-end. Contact me for details.

^_^




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: