wix-incubator / react-templates

Light weight templates for react
https://wix.github.io/react-templates
MIT License
2.82k stars 207 forks source link

feature request: customized function arguments for rt-stateless #215

Open yatra9 opened 7 years ago

yatra9 commented 7 years ago

another request.

It would be nice to allow customization of the argument variables of rt-stateless function (instead of predetermined props and context).

Especially, I want use destructuring assignment feature of ES6 on the props argument.

For example,

<div rt-stateless rt-stateless-props="{person}">Hello {person}</div>

or

<div rt-stateless rt-stateless-props="{{person}}">Hello {person}</div>

Compiled:

define([
    'react',
    'lodash'
], function (React, _) {
    'use strict';
    return function ({person}, context) {
        return React.createElement('div', {}, 'Hello ', person);
    };
});