Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgqfrms-GitHub/d3cbf615b9bfe1e5274e22ae36632576 to your computer and use it in GitHub Desktop.
Save xgqfrms-GitHub/d3cbf615b9bfe1e5274e22ae36632576 to your computer and use it in GitHub Desktop.
ant-design & react click bug!

ant-design & react click bug!

ant-design/ant-design#6576

prevent-react-component-click-event-bubble-to-document

https://stackoverflow.com/questions/44711549/how-to-prevent-react-component-click-event-bubble-to-document

    
//todo


Dynamically add child components in React

https://stackoverflow.com/questions/36651583/dynamically-add-child-components-in-react

    
var App = React.createClass({

    getInitialState: function(){
        return [
            {id:1,name:"Some Name"}
        ]
    },

    addChild: function() {
        // State change will cause component re-render
        this.setState(this.state.concat([
            {id:2,name:"Another Name"}
        ]))
    }

    render: function() {
        return (
            <div>
                <h1>App main component! </h1>
                <button onClick={this.addChild}>Add component</button>
                {
                    this.state.map((item) => (
                        <SampleComponent key={item.id} name={item.name}/>
                    ))
                }
            </div>
        );
    }

});

<Component {...this.props} more="values" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment