title: what is the correct way to dispatch an action in angular?
body: <p>could you please tell me what is the correct way to dispatch an action.</p>
  
  <p>In the component, we do like that using <code>store</code> using <code>store.dispatch</code> than action.</p>
  
  <pre><code>onLoginButtonClick(user: Authenticate) {
      this.store.dispatch(new Authctions.Login(user));
    }
  </code></pre>
  
  <p>Now using <code>ngEffect</code> we dispatch action without using <code>store</code> only use <code>new Action name</code> why ?</p>
  
  <pre><code>export class AuthEffect {
    @Effect()
    login$ = this.actions$.pipe(
      ofType(AuthActionsTypes.LOGIN),
      map((action: Login) =&gt; action.payload),
      switchMap((auth: Authenticate) =&gt; {
        return this.authService.login(auth).pipe(
          map(user =&gt; new LoginSuccess({user})),
          catchError(error =&gt; of(new LoginFailure(error)))
        );
      })
    );
  </code></pre>
  
  <p>why it is used like this </p>
  
  <pre><code> new LoginSuccess({user})
  </code></pre>
  
  <p>can we used like this <code>this.store.dispatch( new LoginSuccess({user}))</code> ? in effect ?</p>
  
  <p>any update?</p>