I've got a banner component that has a message field - in this case a welcome message.
One of the props is called 'headline'
, in which you can enter your message. Currently I'm using the message 'Hi Joe, welcome to your account', but I'd like to pull the name from another prop.
This is what I currently have in the ReactDOM.render:
ReactDOM.render(React.createElement(PriorityComponents.HeaderBanner, {
desktopImage:{},
mobImage:{},
altText:'alt test goes here',
isLeftAligned:true,
userName: 'Joe',
headline: 'Hi Joe, welcome to your account',
label: ''
}), document.getElementById("HeaderBanner"));
The headline is being called in as follows:
<Editable tag="h1" className="headerBanner__body__headline" html={article.headline} />
I thought I might be able to use the following:
userName: 'Joe',
headline: 'Hi ' + userName + ', welcome to your account'
This seems to be breaking the component! Any idea how to reference the username in the headline prop?