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

Problem with starting component


#1

Hi. We started our project with one of previous version of react_on_rails. And as i know, we should export not a component like

export default (props) => (<HelloWorld {…props} />);

But in new versions it looks like:

export default class HelloWorld extends React.Component

Could you help me, with version of React On Rails, were mechanism was export default (props) => (<HelloWorld {…props} />);


#2

Aloha @Maksim_Rukomoynikov!

The current version of React on Rails takes either a React component or a “generator function” in the view helper react_component.

So either syntax should be fine.

  1. React Component
  2. Generator Function