Skip to content

How do I render children? #111

@jackcallister

Description

@jackcallister

I've probably completely overlooked something but how to I render children? In a stand alone front end app I'd write something like this -

var App = React.createClass({

  render: function() {
    return (
      <Polyselect ref="polyselect">
        <Polyoption title="My select option" value="1" />
        <Polyoption title="My second select option" value="2" />
        <Polyoption title="My third select option" value="3" />
      </Polyselect>
    );
  }
});

React.render(<App/>, document.body);

How do I write this with react rails? I imagine it would be like this -

react_component('Polyselect', { ref: 'polyselect' }, [
  react_component('Polyoption', { title: 'My select option', value: '1' })
])

I think I'm missing something fundamental here. Help would be much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions