Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looping is broken at latest Dev. #62

Closed
Havunen opened this issue Jan 7, 2016 · 2 comments
Closed

Looping is broken at latest Dev. #62

Havunen opened this issue Jan 7, 2016 · 2 comments

Comments

@Havunen
Copy link
Member

Havunen commented Jan 7, 2016

Hey,

Looping components seems to be broken at latest dev. It should render two

elements inside div's but nothing happens.

    var BaseView = Inferno.createTemplate(function (v0, v1) {
        return {
            tag: 'div',
            attrs: {
                class: 'login-view'
            },
            children: [{
                tag: 'button',
                attrs: {
                    onClick: v0
                },
                children: 'ADD'
            }, {
                tag: 'br'
            }, v1]
        };
    });

    var Looper = Inferno.createTemplate(function (v0) {
        return {
            tag: 'div',
            children: [
                {
                    tag: 'h1',
                    children: v0
                }
            ]
        };
    });

    var starter = Inferno.createTemplate(function (v0) {
        return {
            tag: v0
        }
    });

    var SomeError = function() {
        this.state = {
            list: ['SS', 'SS1']
        };

        this.render = function() {
            return BaseView(this.toggle, (function () {
                this.state.list.map(function(result){
                    return Looper(result);
                });
            }).call(this));
        };
    };
    SomeError.prototype = new Inferno.Component(null);
    SomeError.constructor = SomeError;

    InfernoDOM.render(starter(SomeError), document.body);

@trueadm
Copy link
Member

trueadm commented Jan 7, 2016

You have a mistake in your code, this:

this.state.list.map(function(result){

should be:

return this.state.list.map(function(result){

@Havunen
Copy link
Member Author

Havunen commented Jan 7, 2016

Thanks its working 👍

@Havunen Havunen closed this as completed Jan 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants