Last active
November 1, 2018 09:27
-
-
Save mrzarkovic/9f29e0c2be03029156e87018fbab841f to your computer and use it in GitHub Desktop.
React props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Primer | |
var Title = React.createElement( | |
TitleComponent, { | |
title: 'Naslov', | |
className: 'main-title' | |
} | |
); | |
// Ili JSX | |
var Title = <TitleComponent title="Naslov" className="main-title"/>; | |
// U komponenti pristupamo prosleđenim vrednostima pomoću `this.props`: | |
render () { | |
return <h1 className={this.props.className}>{this.props.title}</h1>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment