2017-09-10 11 views
2
I'm trying to pass flask variables from the server to react but I can't get it working. At the moment I have a render function in a reactjs file that looks like: 
ReactDOM.render(
    <Attribute prop1='{{ prop1 }}' prop2='{{ prop2 }}' />, 
    document.getElementById('main') 
); 

としてreactjsするために、サーバー上のフラスコのpython変数を渡す:私が持っているフラスコサーバー上のPythonで小道具

return render_template('index.html', prop1=var1, prop2=var2) 

答えて

0

それは

<Attribute prop1={ prop1 } prop2={ prop2 } /> 
する必要があります
関連する問題