How to use redirect_to like method in stimulus reflex?

1.5k Views Asked by At

I am trying to learn stimulus reflex. Working on a basic project management app where I am trying to redirect_to some path from controller. How can I do this using stimulus reflex

1

There are 1 best solutions below

0
Roland Studer On

You don't.

Stimulus Reflex is there to call a remote procedure and rerender the page / or a part of it, with the new state. If you are going to do a redirect after a successful action then you would go for a classic controller action.

It would be possible to emit an event from a reflex with cable ready and listen to that event on a custom stimulus controller to then "redirect" to another page, but that does not make things easier.