react dynamically generated list

Menus through the array [] function in the assembly and render to return to return to the virtual objects Dom.

render() {
        return createPortal(
            this.state.visible &&
            <div className={styles.modal}>
                <div className={styles.content}>
                    <ul>
                        {this.props.menus.map((item,index)=>{
                            console.log(index,item.title);
                            return <li   key={index}>{item.title}</li>
                        })}
                    </ul>
                </div>
            </div>, this.node
        )
    }

 

Guess you like

Origin www.cnblogs.com/Oldz/p/12376162.html