I
I
Isaac Clark2015-09-29 02:42:40
Handlebars
Isaac Clark, 2015-09-29 02:42:40

Handlebars + React.js: how to make it work?

Hello.
For practical purposes, I decided to try using handlebars with react, but I just can't get it to work.
For example, how to make this code work? And does it make sense to use react and handlebars on the project?

render: function () {
        var data = this.state.previewData;

       // ??????????
       // Handlebars.compile();

        return <div className="row" id="compile">
                    <script type="text/x-handlebars-template">
                          {{CompanyName}}  
                    </script>
               </div>
    }

Thanks for the help!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Ineshin, 2015-09-29
@Dark_Knight

Uh, what are you talking about, React has its own template engine, write code in JSX. You are violating the whole concept of React by using a third-party template engine!
If you really want to write templates on Handlebars, go to Ember.js

A
Alexander, 2015-09-29
@OneFive

Initialize Handlebars in componentDidMount

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question