I'm using the react-rails gem to integrate react with rails, and I'm conflicted on how I should organize my code.
Is it preferable that I have my core html in the html.erb
files or in the jsx
files? Currently, I basically made everything a component. All I do in my html.erb
files is using the react_component
helper to call those components. For example, I would have a ProfileShow.js.jsx
file for my profile page and a EditPost.js.jsx
for my edit post page.
What is your suggestion?
I prefer move my react-component's code to js-files. And link them using react_component
helper method. It isn't good practice to write your js-code in views.
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