ShakaCode | ShakaCode Blog | Rails On Maui Blog | Rails | ReactJs | JavaScript | Webpack | Productivity |

Why use a generator function to create a React Component?


#1

I’m confused as to why someone would use a generator function to create a React component to be used by the react_component view helper? Is it simply to gain access to the railsContext? Creating a class that extends React.Component seems to works just fine. I’ve read over the documentation at https://shakacode.gitbooks.io/react-on-rails/content/docs/basics/generator-functions-and-railscontext.html and can’t seem to figure it out. Thanks in advance!