I've created a rails project and then integrated react with it using react_on_rails
gem. I've made one component and placed it inside my new.html.erb using react_component
helper method. Whenever this erb view renders I get the react component and after filling in the fields the component sends a POST request to todos#create
path and the create action after saving the fields redirect to todos#show
because of redirect_to @todo
. The problem is that the show.html.erb is not rendered automatically as before. It gets returned in the response with the React component present inside.
- How do I render the view rendered in the response using a standard way?
- Is there any way to handle this situation without using
react-router
and using only rails defined routes.