Skip to content

Render surfaces dynamically #14

@swennemans

Description

@swennemans

Currently I'm trying to render a scrollview based on data it will fetch from the server. However I'm encountering some problems.
It seems that when knowing the number of surfaces on render beforehand everything will render fine. This will work:

render() {
        let famousSurfaces = range(3).map((event, idx) => {
            let options = {//};
            return (
                <Surface options={options}>
                    Surface {idx + 1}
                </Surface>
            );
     });
     return (
            <Context>
                <View>
                    {famousSurfaces}
                </View>
            </Context>
        )
    }

However, I would like to render my surfaces dynamically based on my props. This props can change because the data doesn't appear all at once. A simple example is this:

render() {
        let famousSurfaces = this.props.events.map((event, idx) => {
            let options = {//};
            return (
                <Surface options={options}>
                    Surface {idx + 1}
                </Surface>
            );
     });

///etc

I've tried some alternative ways to work around it, but with no luck. The above sample is the most simple example, and working with normaal divs this would work.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions