wix-incubator / react-templates

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

Putting components with callbacks in template. #237

Open electic opened 6 years ago

electic commented 6 years ago

Hi,

I am new to react-templates. How would I put something like this in a template:

<Select name="form-field-name" value={value} onChange={this.handleChange} options={[ { value: 'one', label: 'One' }, { value: 'two', label: 'Two' }, ]} />

When I put this in, it throws an error. Any help appreciated!

nippur72 commented 6 years ago

Try using quotes for attribute values

Il mar 10 apr 2018, 14:44 Raj Kadam notifications@github.com ha scritto:

Hi,

I am new to react-templates. How would I put something like this in a template:

<Select name="form-field-name" value={value} onChange={this.handleChange} options={[ { value: 'one', label: 'One' }, { value: 'two', label: 'Two' }, ]} />

When I put this in, it throws an error. Any help appreciated!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wix/react-templates/issues/237, or mute the thread https://github.com/notifications/unsubscribe-auth/ACemK7T5dnzLMiuDbXWAAWxtwp7k4-elks5tnKlLgaJpZM4TOLu8 .

electic commented 6 years ago

I tried that. Here is the component I am trying to use:

https://github.com/JedWatson/react-select

nippur72 commented 6 years ago

the following

<Select 
        name="form-field-name" 
        value="{value}" 
        onChange="{this.handleChange}" 
        options="{[ { value: 'one', label: 'One' }, { value: 'two', label: 'Two' }, ]}" 
/>

did produce a perfectly valid output in React templates playground.

What error message are you getting?