riot-js

Open full view…

Loop __item property question

Stuart Rackham
Wed, 04 Feb 2015 23:45:58 GMT

The loop `__item` property is currently undocumented, is it the correct mechanism for passing the current looped item to a child custom tag? e.g. ``` <ul> <li each={opts.store.todos}> <todo-item todo={__item}> </li> </ul> ```

Tero Piirainen
Wed, 11 Feb 2015 06:28:47 GMT

`__item` was internally used on early versions of Riot and no longer there. You can do following instead: --- <!-- either this --> <li each={ items }> <todo-item todo={ this }></todo-item> </li> <!-- .. or this --> <li each={ item in items }> <todo-item todo={ item }></todo-item> </li> --- I suppose the latter is clearer.