https://github.com/sagemathinc/cocalc
Raw File
Tip revision: a24bb05cbb0ec38730da35f08a5be79bb1416a1a authored by Harald Schilly on 30 November 2020, 13:23:15 UTC
hub: typing "create_account" message and fixing a bug preventing anon user sign up
Tip revision: a24bb05
Writing Components.md
## `rclass`

### Normal Usage
Just use as if your object was being passed to `React.createClass()`

### Enhanced Usage
However, it can also be passed a function which takes in properties only known at runtime. This allows you to do things like pass in names of stores which are generated at run time.
```coffee
ProjectPage = rclass ({project_store_name, another_store_name}) ->
    reduxProps:
        "#{project_store_name}"
            active_tab : rtypes.string
            open_files : rtypes.immutable
        "#{another_store_name}"
            first_name : rtypes.string
            last_name  : rtypes.string

    propTypes:
        project_id : rtypes.string

    render: ->
        <p>Example!</p>

ReactDOM.render(<ProjectPage project_store_name={name} another_store_name={other_name} project_id={project_id})
```
back to top