我設法使我的上一個div組件上我的模板像這樣:如何從模板傳遞道具來反應根節點?
的Index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Example</title>
</head>
<body>
{% load render_bundle from webpack_loader %}<h1>Example</h1>
<div id="react-app"></div>
{% render_bundle 'main' %}
</body>
</html>
我的反應程序:
Index.js
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
const rootElement = document.getElementById('react-app');
ReactDOM.render(<App />, rootElement);
什麼是傳遞數據以反應的好方法?我正在使用Django模板
嘿,你有一個地方,我可以在實踐中看到這個例子嗎?謝謝 – NewScientists