2

We are building an enterprise application using react, redux and react-redux stack. I got stuck in one of the designs and need your help.

  1. We have got some html content, coming from the backend(PZN) and we don't wanna use dangerouslySetInnerHTML(as it's not the trusted source) , instead we would like to use iframe, where src attribute will point to locally stored one of the templates with some placeholders [values will be replaced after the backend call]. How do I bind values to the templates. do anybody know any client side templating engines like handlebars, EJS? Ex:

const Frame = ({src}) => {
   return(
    <iframe src = {src} ref = {(frame) => this.frame = frame} />
     )

The above thing holds good If I just wanna dump the html content into the iframe, but I want to bind the some data values into template before being rendered on the UI?

  • You can pass some data in the URL, `src=http://localhost/somePage?data1=info&data2=info`. – Hosar Nov 16 '16 at 03:23
  • But it's locally stored template like below. . let 's assume , ll makes ajax call onLoad of the iframe and once call is resolved, bootstrap.html needs to be rendered with the binded values. – Puneeth Somashekhar Nov 16 '16 at 03:35
  • Possible duplicate of [Pass value to iframe from a window](http://stackoverflow.com/questions/536538/pass-value-to-iframe-from-a-window) – Tudor Leustean Dec 13 '16 at 11:30

0 Answers0