Is it better to make Backbone.js applications single page applications? [closed] - backbone.js

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Since Backbone's Router only work with "#", it means that it should be all in the same page. Should a BB application be only in one page and have only 1 Router?

One of the many nice things about Backbone is that it is very unopinionated about how you work with it. For example, if you just want to use views, then you can do that, and if you want to just use models, you can do that as well.
A Backbone application can be a single-page application, and it certainly provides a lot of functionality to make that easier if that is your goal, but it doesn't have to be. There is absolutely nothing wrong with explicitly calling your views by hand instead of using a router.
To answer the second part of your question... No, you can have as many routers as you like. However, I'd say a large portion of Backbone apps out there make do with just one. I am working on a Backbone app that has over a hundred different views, and I've never run into an issue where I'd have to introduce a secondary router.
Finally, a bit of a correction on your end; The Router object actually doesn't enforce the "#" anymore as long as your browser has pushState functionality. Older browsers (mainly IE) will fallback to the hashtag approach if necessary.
Hope this helps!

Related

What is the best way to store data for Next.js websites? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 days ago.
Improve this question
I'm currently building a website in Next.js and I've gotten to the Blog page which got me thinking about how to handle this page but also whether or not I should approach the rest of the pages differently too. I am just hard-coding all the content (text and images) and I was wondering if there is a better/smarter way to do this? Or should I keep going like this and also hardcode blog posts into my website.
I'm not that experienced so I wouldn't really know how this affects performance or other aspects.
Better or smarter way is very subjective in my opinion. But I will give you some options:
Hardcode it just like the way you do right now. It won't affect performance but you will have to write the code, push it to some version control (if you use one), trigger the build, and make sure it works.
Use Markdown file for every post and have next.js automatically build routes of it. See this tutorial if you wanna take a look. The pros are it's simple (doesn't need a database), and you don't have to write the entire code -- just write the content in a markdown syntax. But you still need to push your changes and trigger the build.
Use headless CMS like Strapi, etc. Personally this is the most convenience way. Write your content, click that Save button, and you're done. But it needs more setup then the other options.
Create your own backend and database setup.
Hope it helps.

When should you use a front-end framework like Angular or React, and when just use plain HTML/CSS/JS? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I know that for a simple static website, using plain HTML.. is the easiest and quickest way. But, what are some use cases between the two options? Is using a framework mostly the best solution?
You can basically see frameworks as pre-written structures for your App.
In other words, frameworks are meant to help you building applications quicker by addressing common development problems.
So, going back to your question, there are not really times where you would prefer vanilla javascript over frontend frameworks due to the incapacity of scaling well, which could result in inscrutable and unmaintainable spaghetti code.
Other bit you would want to consider about frameworks, is their high performance obtained thanks to their virtual DOM (abstract map of the real DOM), which helps handling events to update parts of the App without the need of re-rendering it.
On the other hand, I would suggest to go with a static website using pure HTML and Vanilla JS, only if learning / instructing someone, or if building something really really simple (but rest assure 99% of your commercial websites may suit better under a framework rather than without).
If you want to read more about it, I would suggest the following articles:
https://stackoverflow.blog/2020/02/03/is-it-time-for-a-front-end-framework/
https://gomakethings.com/why-do-people-choose-frameworks-over-vanilla-js/
https://www.freecodecamp.org/news/do-we-still-need-javascript-frameworks-42576735949b/

AngularJS in a professional environment [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
Can you call an Angularjs app a single page angular application if while it's built/setup in angular, but then you might use jQuery for a carousel image or jQuery for fade effects or something like this added to the site that isn't angular. Would it technically be a single page angular application if jQuery or something else is incorporated in the app? I'm asking because of when I see job listings for single page applications, I want to make sure I fully understand the underlying meaning of a single page application
Also wouldn't it technically not be a single page if ng-src routed to another .html file and the page refreshed to do so as opposed to using routeprovider and locationprovider to make it appear without refreshing via ng-view?
That may come as a surprise to you, but Angular have its own jQuery subset implementation called jQLite. As long as you load a single HTML page and dynamically update its contents instead of navigating away, it is an SPA regardless of javascript libraries in use.
That's kind of opinion-based, but I would call it a non-SPA since it causes a refresh (for something other than, say, updating to a newly-deployed version.)

Are there any features that ReactJS possess, while AngularJS lacks? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I was playing with ReactJS for a bit, and given a bit of prior exposure to AngularJS, and the way things are done in the latter, I had a hard time to get used to the syntax and the 'flow' of React.
So I had the above-mentioned question, plus: are there scenarios when ReactJS should be preferred to AngularJS?
Could anyone point out what can be done [easier/better/more efficiently] in React rather than in Angular, and other way around.
It's actually the opposite. Angular has a lot of features, apis, configuration options, etc. React tries to be much simpler and let you choose how your application is structured. Controllers, directives, and templates are reduced to just components. Services are just plain JavaScript, there's nothing React specific about it. Things like $q and $timeout don't exist because there's no digress (use anything you like for those).
You use React in your application, vs making your application in angular.
ReactJS uses the concept of virtual DOM which speeds up the rendering of the app.
Watch Pete Hunt's excellent video on Virtual Dom here:
https://www.youtube.com/watch?v=-DX3vJiqxm4
The syntax might be very unconventional but the same thing can be said about Angular's concept of Directives, services, controllers, etc. It just takes time to get used to, but once you feel comfortable, you'll find that thinking in ReactJS really makes sense.

Do i need a JSframework? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I want to add some JS functionality to our site. (wishlist, inquiry, ect) I think it would be nice for the UX that it is going to be build with some JS code
Do i need a JSframework like Angular, ember ect ? Or are JSframeworks only make sense for SPA like editing/backend tools?
That decision is up to you. AngularJS is awesome, but it's not really meant to be used for little pieces of a project. For my taste, I'd write everything with AngularJS. You probably want to check out Backbone if you want to only use it here and there.
From Backbonejs.org:
Philosophically, Backbone is an attempt to discover the minimal set of
data-structuring (models and collections) and user interface (views
and URLs) primitives that are generally useful when building web
applications with JavaScript. In an ecosystem where overarching,
decides-everything-for-you frameworks are commonplace, and many
libraries require your site to be reorganized to suit their look,
feel, and default behavior — Backbone should continue to be a tool
that gives you the freedom to design the full experience of your web
application.
Angular is more like the "overarching, decides-everything-for-you frameworks" it mentions.

Resources