Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to resolve click for div logging as parent too, in react

var App = React.createClass({
  handleParentClick: function (e) { 
    console.log('parent');
  },

  handleChildClick: function (e) {
    e.stopPropagation();
    console.log('child');
  },

  render: function() {
    return <div>
      <p onClick={this.handleParentClick}>
        <span onClick={this.handleChildClick}>Click</span>
      </p>
    </div>;
  }
});

ReactDOM.render(<App />, document.getElementById('root'));
Comment

PREVIOUS NEXT
Code Example
Javascript :: check the constructor property to find out if an object is an Array (contains the word "Array"): 
Javascript :: app-root modal component 
Javascript :: vue apollo refetch every x ms 
Javascript :: check if anagram 
Javascript :: jquery event when element is rendered 
Javascript :: jquery ui sortable disable child 
Javascript :: javascript get local timezone 
Javascript :: validate date 
Javascript :: get day first 3 letters name in js 
Javascript :: ddd 
Javascript :: send email using javascript and mailtrap 
Javascript :: settimeout react native focus text input 
Javascript :: Destructing variable assignment 
Javascript :: This will give Iodoform reaction on the treatment with Na2CO3 and I2: 
Javascript :: de-encrpting data in javascript 
Javascript :: https://web.roblox.com/users/20732870/profile 
Javascript :: classe jquery 
Javascript :: js get word before question mark 
Javascript :: how to allow the onclick event of a string in javascript 
Javascript :: code converter javascript to python 
Javascript :: type.js 
Javascript :: what is the purpose of the super(props) method in React 
Javascript :: react export multiple component from index.js 
Javascript :: veu js vs angular vs react features 
Javascript :: canvas circle blurry 
Javascript :: JavaScript startsWith() example with Position parameter 
Javascript :: jquery slick remove white fade 
Javascript :: Angular : pass data to component loaded via route 
Javascript :: show hide pseudo element jquery 
Javascript :: js get key value from url 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =