Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
Confusion about NgRx Actions in Angular

I've inherited an Angular codebase that contains all the latest tricks and techniques, and I'm having trouble understanding some key things. Normally when I inherit a codebase in any language, I find that I can search it for terms used in one place to see how they are implemented in others and gradually come to an understanding. This doesn't seem to work with NgRx Actions, however. I don't understand the point of code such as

const LOAD = '[Trailer Info Specifics] Load All ';
const load = createAction(LOAD);
export const TrailerInfoActions= {
  load
}

When I search the codebase for "Trailer Info Specifics," it only appears in this one file. So what is the point of the name of the action? What digests this information and acts upon it? I've tried watching videos about Angular Reducers/Actions/Effects/Facades and my eyes just glaze over. None of this makes any sense. I come from the world of imperative programming, so I understand there is a learning curve, but this is just so confusing and none of the tutorials I've found are any good. I'm hoping someone can point me in the right direction.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The type is the only thing that is required to create and send (store.dispatch) an action. Based on the type, reducers and effects know what to do. They receive all dispatched actions and filter based on this type (that's why it's important to keep action types unique).

It's recommended to follow the "Good Action Hygiene" pattern when declaring types. The template of a type is [Source] Event, this makes it easier to debug/get to know the application because you can see where the action is dispatched.

The reason why you can't find more references of the type is because we don't want magic strings in an application (these are brittle). Instead, you can look for TrailerInfoActions.load to know where the action is dispatched and which reducers/effects do something with it. (The type is a static property on the action creator, which is used to filter actions in reducers/effects.)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!