score:223
Accepted answer
You can use string concatenation
<a data-featherlight={'string' + this.props.data.imageUrl}>
or use Template strings
new ES2015 feature
<a data-featherlight={ `string${this.props.data.imageUrl}` }>
score:1
As far as I know, first:
<a data-featherlight={'your string' + this.props.data.imageUrl}>
Second:
<a data-featherlight={`your string ${this.props.data.imageUrl}`}>
score:5
You can also try it:
<a data-featherlight={'string1' + this.props.data.imageUrl + 'string2'}>
or
<a data-featherlight={ `string1 ${this.props.data.imageUrl} string2` }>
If you are using Link component then you can concatenation like this:
<Link to={`getting-started/${this.props.message}`}>
<h1>Under {this.props.message}/-</h1>
</Link>
Source: stackoverflow.com
Related Query
- In JSX how do I set a className as string + {prop}
- How to run a loop inside a jsx string set using dangerouslySetInnerHTML
- How to concatenate two JSX fragment or variables or string and component (in Reactjs)?
- using css modules in react how can I pass a className as a prop to a component
- How to render a string with JSX in React
- How to set innerHTML jsx format
- React How to fix Failed prop type - Invalid prop of type string expected object
- How to return string or JSX element in TypeScript React component?
- How to enable className autocomplete on custom jsx tags (aka react components)?
- React js: How to set props in JSX components which store in variable
- How to set up jsx syntax highlight and Intellisense in Visual Studio Code 1.5.2?
- Set Prop Key Dynamically JSX
- How to create a DOM element in JSX using string concatenation
- Error: "MyDocument.getInitialProps()" should resolve to an object with a "html" prop set with a valid html string
- How to set a prop from a function
- In JSX | React How can the prop be passed to the button state so the button state can load a new page?
- error: MyDocument.getInitialProps()" should resolve to an object with a "html" prop set with a valid html string (in document.js)
- If true set attribute else set className in JSX
- How to set default variable in JSX for const with selector
- In React Hooks. How to set state to a random number and use that to display a string from an array
- How to conditionally set HTML attributes in JSX using reason-react?
- how to set prop type in react + typescript
- How to set prop in react bootstrap(Dropdown) from parent
- How to convert string to JSX to using in React
- How to require a mountable prop set via reference in React
- How to set an interface from object values avoiding string type
- How to pass prop as a className using makeStyles
- How to concatenate a variable and string inside a prop in Javascript?
- How can I set JSX to a variable so that I can optimize my code?
- How to set a key prop in a select element
More Query from same tag
- React JSX Syntax
- Call Method on createClass result Should be simple
- React implement activity wheel while waiting on API call to return data
- Firebase chained database requests not working properly
- Need ref to <input> from semantic-ui-react's Form.Input - which is surrounded by divs in React
- ReactJS: State variable not updating as expected
- Trying to place an image in a fixed positon. Why the image is misplaced until I do a page refresh?
- How to add Validations to my Input Field in React JS
- react-table lost focus on filter?
- Chaining Redux Async Actions
- Spotify player SDK in react
- Why am I getting this error "TypeError: Cannot read property 'value' of undefined"
- How to change dynamically the render of icons inside a table based on a type of the data coming
- TS2339 when trying to conditionally disable a link
- How can I render <Card.Text> as <div> element and not as <p>?
- How to return multiple values from lodash _.times?
- Floating Action Button not sticked to its parent element
- Socket io connected users key value array
- Why is my initial state value in useState undefined?
- Iterate over all refs values in component
- Meteor / React / React-Router /CreateContainer - can't get this.state to be set according to props when using params
- Make the columns the same width inside Grid React
- material ui: reactjs: tablecell: width fit to content
- React: update state with props change - handleChange and getDerivedStateFromProps
- React unique key - Index and ID are not unique key prop
- React - useCallback throwing error on renderProps function
- In REACTJS, same function has different state depending from where (in the dom) is called
- Passing HTML element into React Component before Element is Rendered
- How to call Json objects dynamically in react
- React ref returns a 'Connect' object instead of DOM