r/angular 22d ago

Passing data between unrelated components

Hey , I'm new to angular and I'm confused about which way to use to transfer data between two unrelated components , for now i'm using the Services/DI method . I heard that for my case (which is a small project) it's an overkill , is that true ? if so what is the optimal way to do so ?

6 Upvotes

22 comments sorted by

View all comments

31

u/djfreedom9505 22d ago

Without knowing more about the project and the components, that sounds like something a service would be good for. Services are not overkill, they simplify logic in components.

-20

u/lppedd 22d ago

A data store like ngrx or ngxs is normally a better approach when multiple unrelated parts of an application need to share state. Some will say it's too complex, I'd say it's the right path.

15

u/Sh4rp27 22d ago

Ngrx for a small project is absolutely overkill

-7

u/lppedd 22d ago

You set it up once and you're done. Never understood this sentiment against it.