Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Like this

<my-tag>

  <nested-tag1 if={ parent.val }/>

  <nested-tag2 if={ !parent.val }/>

  <input oninput={ edit }>

  edit(e) {
   this.val = e.target.value
  }
</my-tag>


Thanks for responding.

You might want to look at insin's comment above. In insin's code example, the conditional doesn't work on a component, but does on a normal HTML tag. Would that be a bug?

The lack of true conditionals is a turn-off for me. React's conditionals lets you build things like react-router without any extra semantics, in which the router picks up the appropriate component based on the URL.


On the child component you refer the parent data with `parent.` prefix.


Toggling display of child components with an "if" attribute doesn't work if I change the expression to parent.component either - evaluating a component attribute declared in a parent in the context of the child is pretty surprising, if that's what happens.

It seems like using a value attribute on a <select> doesn't set the selected value, I had to manually set selected on the <option>s to get it to work, and updating the value from elsewhere doesn't seem to affect the selected option either way.

Checkbox events are throwing "SyntaxError: function statement requires a name".

Wrapping the display of the disabled value in () instead of [] throws "SyntaxError: missing formal parameter" on load.

Updated gist showing these here: http://bl.ocks.org/insin/5e0bf04cf1f701c235ad

I don't see any docs on using forms - is support for form elements still a work in progress?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: