Skip to content

Instantly share code, notes, and snippets.

@mijms
Created July 22, 2021 06:41
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 mijms/8246c8c757cb37466cc8b7329028e7b8 to your computer and use it in GitHub Desktop.
Save mijms/8246c8c757cb37466cc8b7329028e7b8 to your computer and use it in GitHub Desktop.
export default class Authorized extends Component {
handleClick = () => {
const { onClick } = this.props
const authorized = checkAuthorization()
if (authorized) {
// console.log('authorixes')
onClick(d)
}
// show Not Authorize Popup
}
render() {
return (
<this.props.children onClick={this.handleClick} />
)
}
}
<Authorized onClick={myNormalClick}>
{(props)=>
(<ClickedComponent onClick={props.onClick}></ClickedComponent>)
}
</Authorized>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment