How to add tag using ReactJS?

I know this is old, but i stumbled upon this recently and here is the best solution i found (i’m using it for browser polyfills, but it works for any code):

render: function() {
  return (
     <div>
        <SomeReactClass somefunction="myFunction">
        <script
          dangerouslySetInnerHTML={{ __html:
            `function myFunction(index, row) {return index;}`
          }}
        />
     </div>
  );
}

Leave a Comment