question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pass JSX as params

See original GitHub issue

Is there any way to pass JSX as parameter to the translation function? I’m trying to do something like this:

      const name = <span className="name">{user.name}</span>;
      return this.context.t("Hello {name}!", {name: name})

Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
pablencommented, Mar 29, 2017

Cool. Really grateful for this tool. I was worried when I had to add i18n to my project but this little tool solved the problem with minimal effort. Thanks!

1reaction
francescarpicommented, Mar 29, 2017

Hi,

I just see that we can’t print html directly for security reasons. You should use “dangerouslySetInnerHTML” method. I’ve updated documentation in this branch:

https://github.com/APSL/redux-i18n/tree/trans_to_reducer#html-object-as-parameter

I’ll merge to master as soon as possible. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - ReactJS(jsx) Passing Parameters - Stack Overflow
ReactJS(jsx) Passing Parameters · 1. Paste your code. Not an image. · 1. The props in React component is expected to be in...
Read more >
Passing Props to a Component - React Docs
React components use props to communicate with each other. Every parent component can pass some information to its child components by giving them...
Read more >
How to Pass Data between React Components | Pluralsight
This guide summarizes three approaches to handling data in React: Passing ... The primary concept is passing the parameters to the following ...
Read more >
How to use Props in React - Robin Wieruch
Since props can only be passed from parent to child components, how can a child component communicate with its parent component? This a...
Read more >
How To Pass Params to a Component in React Router
Run the React App and you will see the links displayed. As you click on any of the links, it will take you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found