I am new with React and today I was working on react-routers. I am not clear which routes to use. My choices are Rails routing or React router. What are the difference between these?
React should be used for rendering and Rails should be used for the API. Each react app should have its own server-rendered path, with calls to a rails API on the backend. The API should definitely be routed with rails, but only pass back the data you need to the react app. Rails 5 has ApiController you can use for your controller superclass. TL;DR - React is frontend, rails API on the backend.
Also, you should really determine if you need something so heavyweight on the backend. Some lighter ruby alternatives are Sinatra and Padrino.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With