creativecommons / creativecommons.org

Legacy legal code translations and general support issues
MIT License
156 stars 204 forks source link

How to embed a license icon on my React.js application? #1015

Closed 5ervant closed 5 years ago

5ervant commented 5 years ago

Hello, whenever I tried to embed a licence icon on my React.js application, I'm seeing this error:

SyntaxError: D:\Node.js Projects\React Apps\Project Name\components\ComponentName.js: Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can turn on the 'throwIfNamespace' flag to bypass this warning.

28 |           </a>
29 |           <br />
30 |           <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">
|                 ^

I tried to replace xmlns:dct with xmlnsDct and the other namespace tags with their camelCase forms but that just caused another problem making xmlnsDct and the others non-valid properties.

Any solution for this?

kgodey commented 5 years ago

tagging @brenoferreira

5ervant commented 5 years ago

Setting it as an inner HTML like the following will do the work:

<div
  className="license"
  dangerouslySetInnerHTML={{
    __html: `
      <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">{/* CHILD ELEMENT */}</a>.
    `
  }}
/>