score:4
Accepted answer
either pull out the concatenation out of the href or use bacticks
to fill the href.
<a href={`mailto:${customeremail}?subject=quote&body=i%20would%20like%20to%20accept%20this%20quote`} >
<button>click to accept</button>
</a>
score:3
you are missing the curly braces inside the href attribute:
var customeremail = "someone@email.com";
<a href={'mailto:' + customeremail + '?subject=quote&body=i%20would%20like%20to%20accept%20this%20quote'} >
<button>click to accept</button>
</a>
the curly braces are a special syntax to let the jsx parser know that it needs to interpret the contents in between them as javascript instead of a string.
Source: stackoverflow.com
Related Query
- How do you dynamically set a recipient in a mailto link?
- How do you set displayName dynamically with a higher order component?
- How do you set the document title in React?
- How do I dynamically set HTML5 data- attributes using react?
- How to set activeClassName for wrapper element of Link or IndexLink in react-router?
- How to set HTML lang attribute dynamically on NextJs Document?
- How can you set path of match with MemoryRouter and Jest? (not location or history)
- How to set value dynamically inside Form.List using setFieldsValue in Antd 4?
- How do you set the Typescript type for useRef hook in React Native?
- How to acess React context from Apollo set Context Http Link
- Typescript & ReactJS How To Dynamically Set State
- How to enable Ctrl + Z when you change an input text dynamically with React?
- React how to dynamically set div height to follow suit of full window height including scroll
- How do you dynamically insert a React component into the DOM (for instance a dialog)?
- How to set initial tab in react navigation TabNavigator dynamically
- How can I set the source of an image dynamically in React native?
- How do you dynamically update a key-value pair on a typed object in TypeScript
- How to dynamically set height of a component whose height is an animated value post-animation?
- How to set ErrorMessage on TextField dynamically on Button onClick method
- How can you use the 'this' keyword inside of a function signature to set a default parameter?
- How to set active link in Navbar using Nav.Link and React Router?
- How to dynamically set state with onChange event handler in a functional component
- How can I set focus on a dynamically added field with React
- How do you set the material-ui cardholder avatar?
- How to set a css property (background-color) dynamically in React?
- How do you call modules dynamically with a namespace import from index file?
- How can I set dynamically the number for useNavigation hook?
- How do I set Gatsby Link to be an <li> tag instead of an <a> tag?
- How to dynamically set variables in mutation with react-adopt?
- How do you set types on getting Object.keys on JSON file in TypeScript?
More Query from same tag
- Enzyme expects an adapter to be configured
- How to convert Promise to String? I used Axios and return the data to my react Component
- using State to get the input value while text is changing. if then, while text is chaing, all will rerender again. does this make the app very slow?
- Discord Bot should react to his own dm that he sent
- Mapping two table ,React or Sql?and how?
- Testing of useEffect hook with try/catch
- How to make Radio buttons of the same Radio group align in several columns in Material UI?
- react form onChange to update state
- React's Python-like formatted string
- Adding dynamic states in reactJs
- Pass event and arguments onChange in input in React
- Test a component is rendered with React Router's render prop using Enzyme's shallow wrapper and Jest
- How to add two refs in input? reactjs
- How to get a React Component reference to change its class using classList?
- How to change the tab indicator color of a tab with a validation error?
- How do I pass in objectId from the react front end to server-side graphql?
- How can I build the dev env and the prod env differently in build time? etc) db config
- issue hosting on firebase with React-Redux app?
- How can I create dynamic input sliders with react?
- Using custom component in ag-grid cell render
- gatsby HTML file size too large (i.e. due to bootstrap-CSS)
- Publish React app to Github Pages using github Actions
- What's the difference between hydrate() and render() in React 16?
- Redux-thunk dispatch not working
- Mobile responsiveness in Next _app.js?
- SetTimeout and For loop
- cannot get updated state from the store
- Race condition in React setState and Promise
- what's the right way to remove dynamic DOM Nodes from an event handler in React?
- How to use scss variables in create react app?