React redux application folder structure [closed] - javascript

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 4 years ago.
Improve this question
I understand the concept of a react/redux app.
My question is, is there a preferred way to layout the folder structure and files.
After doing much research of repos online it appears that everyone does it slightly differently depending on their code flavor.
Angular on the other hand appears that there is a set structure.
Is this what makes react more powerful as you can tweak and adjust as your needs change?
Has the community agreed on any set patterns?

As you said yourself; 'Everyone does it slightly differently'. It can help to give some resources right?
I don't know how much experience you currently have with React. I personally started with a traditional structure that made use of the dumb / smart component pattern, in which I created a src/redux folder. Within that I had an actions + reducers folder. This works fine for smaller applications.
I changed that approach after learning about the Redux Ducks pattern, which removes a lot of boilerplate and copy-pasting reducers.
I'm currently using this structure.
My suggestion is to try different approaches and see what works best. It depends on how you and your colleagues work in general. For example - if you know that everyone uses their CMD+P to search for specific files, you'd prefer being more explicit in file names, instead of having an actions/posts.js and reducers/posts.js file you'd prefer creating postsActions.js and postsReducers.js instead. I'd suggest reading these two Medium posts aswell, as inspiration:
My journey toward a maintainable project structure for React/Redux
How to better organize your React applications?
Edit on 31 july 18:
Seeing as a lot of people still read this comment and upvote it. I would like to recommend that if you're starting to work on a medium to large project, I would definitely try and get some knowledge about TypeScript and React. I've completely migrated to TypeScript as it makes it a lot easier to step back into a project after a while due to typings, interfaces, generics, and it being more strict. It greatly helps for your overview of the project. Several downsides of it is that you have to learn the typings of the React library and how to use this. TypeSearch greatly helps to see if there are typings available for a specific library. Also some patterns like higher order components can be awkward in TypeScript due to typings at first.

Related

Can standard JS libraries be used in Vue.js/React? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Without Vue/React I "developed" applications in Vanilla Javascript. There I used some libraries to reuse code from others. Take chart.js as an example: I used it to plot a chart in an election application.
Bootstrap, for example, has a package that is specific to Vue or React. What are the benefits of an specific "library" to the framework?
Applications that don't have specific packages
Now, let's see chart.js: out of my research I haven't found a specific package to Vue.js. How can I use it if so? What about CSS wrappers like Primer and Fomantic-ui? Can I do the same thing as in static applications?
Sorry if this is confuse somehow. If necessary, please ask me for clarification in the comments.
I think any UI library is mostly concerned with the framework specific way of handling things like view updates, rendering, and styling. The frameworks have different concepts regarding those things and therefore individual libs are often necessary to utilize a frameworks ability. When something is being rendered differences in the frameworks have to be taken into account. Therefore you often see library versions for each FE-framework
On the other side, Javascript will always work and therefore a library which bundles functionality (e.g. moment, lodash) can be used in every framework in usually the same way.
If you want to share UI components I strongly recommend using web components which solve framework specific problems like styling as a web standard. You can use them with every framework (e.g Ionic).
In conclusion: JS libraries which aren't concerned with rendering can usually be reused. When it comes to UI libraries, like bootstrap as you mentioned, components often have to be written for each framework. Web components can be a solution because they work with every framework as well as vanilla JS.

When to use React [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I've been learning part of the MEAN/MERN stack and feel somewhat comfortable using MongoDB, Express, and Node. I'm moving onto the A/R of the stacks and am having a bit of trouble understanding when these are applicable and when they're not.
To try to put my thoughts into words, I would ask this:
Is Angular and React applicable to nearly all web applications or were they built for a certain niche? For instance, one of my first projects will be creating a portal for employees to use for various tools to help them with their work as well as to transition from Excel based forms to web based forms.
When creating a site like this, is Mongo/Express/Node enough?
I'm kind of struggling to explain this as this React course I've been trying to complete is making my brain feel like its over flowing. I've learned HTML/CSS/JS + Mongo/Express/Node over the past few months including ES2015-2017 and such so immediately learning React on top of that feels a bit overwhelming. For some reason my head is having trouble 'Thinking in React'. Not necessarily breaking things down to components, but the props and states aspect of it all.
For instance, I understand what pure functions are but I don't feel experienced enough to know how to refactor a non-pure function to a pure one and be confident.
I hope this is making sense... Coding has been wonderful. Not only am I having fun but it's really given me motivation to better myself and my knowledge and as well as given me a goal to reach.
Any direction on how to tackle React as a newbie would be extremely helpful.
I'd like to share my thoughts on how you can get started with React. Maybe a first look at https://github.com/markerikson/react-redux-links would be nice, if you already familiar basic react and its enviroment. Here the section Data Flow: “State” and “Props” seems to be something you seek for.
Don´t get overwhelmed by all the surrounding libraries, concepts and so on. It actually will get pretty clear after you built your first own react and later redux applications. The don´t have to look nice, just tackle concepts like Higher Order Components, passing data from childs to parents etc.
If you´ve got questions feel free to ask. Im digging in react too.
This is a very wide question, so I will give you a narrow answer: REACT
Seriously, just stop searching for these type of answers because there is no right answer. Angular programmers will tell you angular and vice versa.
Just GO and start coding man :)

Which code design pattern should I use in nodejs? How to design good data base? [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 5 years ago.
Improve this question
I have experience in games development(C/C++/C#) but recently I started writing automated test and I wanted to learn some backend stuff. I'm writin platform for automated backups, making builds from git repo and testing. I decide to write server in Node.js with PostgreSQL. I have 0 experience in web development. Never ever have I use a database or javascript. I think homemade project like that will be a good starting point. I want to ask two questions. First: Which code design patter will be the best for learning Node.js? Second - Could you please tell me if this pre-alpha database concept is currently good or should I change it?database
No one will be able to answer your questions as you asked them but I'll try to give you few hints. First of all PostgreSQL is a very good relational database so if you need a relational database then it's a good choice but there are other types of databases like graph databases, document databases, key-value stores etc. that you should also consider when designing your architecture. For anything complex it is common to use more than one database.
It's hard to recommend any code design pattern. I can only recommend starting from a good style guide like the one from Airbnb and enforcing it with a linter - see: http://airbnb.io/javascript/ - and following a style guide writing your backend in a style supported and recommended by a given framework that you're going to use. Some examples: Express, Hapi, Restify, LoopBack, Serverless, Seneca, Koa, Sails, etc. Google all of them and read examples to see which one feels best suited for your needs.
Links to more frameworks to consider:
http://nodeframework.com/
https://github.com/sindresorhus/awesome-nodejs

Is there a benefit in using Lodash in an AngularJS project? [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
Has anyone implemented Underscore or Lodash into their existing AngularJS project for a performance boost? If so:
Were the changes something noticeable or something that you would recommend?
Which functionality from Lodash did you find the most benefits?
I have not actually played with Lodash before and was looking into learning it. But I typically like to learn something and then actually use it shortly after, so that the concepts stick better. If I'll get some good benefits out of implementing Lodash, then I think it would be a good time to learn it now.
I do typically need to perform functions such as filtering or finding an object inside some sort of collection, so I'm thinking that's where I would utilize it the most.
Well they have really different purposes.
Angular is to build an application. It helps you to structure your code and separate responsibilities between your components (modules, controllers, services, directives, routers).
Lodash is nice to manipulate collections, arrays, objects, strings, etc. It helps your code to be shorter, cleaner and probably faster. It is really well tested and documented. In my opinion, it makes your job simpler.
I use Lodash for 4 years now. I found it useful in all my projects (Backbone, Angular, JavaScript, node, in the unit tests, in the build configuration files (Grunt, Gulp, Webpack)).
PS: Lodash is also a must-have to go into functional programming in JavaScript.
Edit: Example of searching that you can't easily achieve without Lodash

Is angularjs a good fit for large datacentric enterprise web application [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 am trying to build a web application which will have many different pages. each page mainly shows data in table and various graphs based on data.
I want to decouple front end completely from the backend. for this reason I am considering angularjs.
My concern is following two points:
angular js is considered best for SPA style applications
angularjs will load the partial view when required and will load data through ajax, every page needs at least two seperate http requests to render the page.
Is it really a good choice to select angular or any better approach?
I think that using Angular is a good solution, I am working in a very big project, that manage a lot of data and angular is working perfectly.
There are a lot of advantages of using Angular. However, I think that it depends on your needs, if you don't need a rich experience of user, maybe you can select other option different from a SPA that could be faster, if you don’t have experience developing a SPA..
I think that in your case, it is most important choosing well the backend technology than the frontend technology, because the responsibility of managing the data is from the backend.
I hope that helps.
Angular JS is a good for these kind of applications.
1.) Angular JS simplifies your code.
2.) It builds on HTML so you don't have to learn something entirely new and it is fast to catch up.
3.) It has a large community so you can get help on topics easily.
4.) It is continuously evolving.
5.) It is based on MVC structure.
P.S: Read on dirty checking part of angular as it is considered best in some scenarios and not so good in others. It is considered to keep no. of objects to 1000 or less while using angular for good performance.
Hope that helps! :)
From my experience I would say yes, is good. But maybe you can see with your eyes some case studies and applications built with angular: builtwith.angularjs.org.
Check this blog post also: Building large apps with AngularJS.

Categories

Resources