Is my method correct if I want to pass the this.prompt()
function from TitleBar
to Portfolio
?
This is what my index.html
file looks like:
var TitleBar = React.createClass({
render: function() {
return(
<div className="jumbotron">
<div className="container">
<kbd className="fullName">name name</kbd>
<button onClick={this.prompt} type="button" className="btn btn-primary portfolio">Portfolio</button>
<button type="button" className="btn btn-primary about">About</button>
<button type="button" className="btn btn-primary contact">Contact</button>
</div>
</div>
);
}
});
ReactDOM.render(<TitleBar/>, document.getElementById('firstBar'));
var Portfolio = React.createClass({
this.props.prompt(
alert("hi");
);
render: function() {
return(
<p className="text-primary">Portfolio</p>
);
}
});
ReactDOM.render(<Portfolio prompt={this.prompt}/>, document.getElementById('portfolio'));
Here's my index.js
file:
var TitleBar = React.createClass({
render: function() {
return(
<div className="jumbotron">
<div className="container">
<kbd className="fullName">name name</kbd>
<button onClick={this.prompt} type="button" className="btn btn-primary portfolio">Portfolio</button>
<button type="button" className="btn btn-primary about">About</button>
<button type="button" className="btn btn-primary contact">Contact</button>
</div>
</div>
);
}
});
ReactDOM.render(<TitleBar/>, document.getElementById('firstBar'));
var Portfolio = React.createClass({
this.props.prompt(
alert("hi");
);
render: function() {
return(
<p className="text-primary">Portfolio</p>
);
}
});
ReactDOM.render(<Portfolio prompt={this.prompt}/>, document.getElementById('portfolio'));