Eventually, I’ll get back to this …
Use fetch to communicate state between Clojure Selmer and React JS. For example, …
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
;;TODO: import useState and useEffect hooks ;;See example at https://youtu.be/w7ejDZ8SWv8?t=5293 ;;TODO: Figure out DELETE and PUT for Selmer const App = () => { const [someState, setSomeState] = useState(“”) useEffect(() => { const fetchTasks = async () => { const res = await fetch(‘/someendpoint‘) const data = await res.json() console.log(data) } }, []) } |
useEffect in this example fetches the data from a Selmer endpoint that returns JSON. Set state of the properties you wish to change, so React can update its own DOM.