javascript - Keeping props bound when sending them in a click event in React.js -


we have component being sent function , rendered elsewhere in react.js. ability open slider given content. give child component props parent , when first load of course, need watching state changes. example:

<contact   handlenew={() => globalslider.opencontentslider({     content: <personalcontactdetail _flags={_flags} />   })} /> 

of course _flags set appropriately on open, state changes not cascade through.

any ideas?

a property on contact component needs updated, otherwise won't re-render (and therefore can't re-render personalcontactdetail). don't know architecture of course, perhaps can pass _flags contact component, , pass them handlenew() handler argument....

<contact flags={_flags}   handlenew={(flagargs) => globalslider.opencontentslider({     content: <personalcontactdetail _flags={flagargs} />   })} /> 

... somewhere inside contact:

if (this.props.handlenew) {   this.props.handlenew(this.props.flags); } 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -