Fork me on GitHub
#clojurescript
<
2023-12-19
>
vraid20:12:46

Hi, does anyone know a good intro / documentation for handling mouse events with re-frame + reagent? Specifically on a canvas component. I'm quite new to it, and do not know react. Thanks!

p-himik21:12:35

I doubt you can find a good doc on such a specific subject. That being said, if you split the problem into its constituents, it becomes trivial to research: 1. How to handle mouse events on a canvas in JS 2. How to work with mouse events in React 3. How to translate React code to Reagent I haven't checked so might potentially be wrong somewhere, but as an example for a mouse click: 1. Probably by handling the click event on the canvas DOM node 2. Probably via the onClick property passed to 3. Certainly by using :on-click or :onClick as a property for [:canvas ...].

👍 1
p-himik21:12:09

You can extend that logic to absolutely anything. Good source for JS-related docs is the MDN website. As for React/Reagent/re-frame - their own docs are great as a reference and also a learning material.

vraid22:12:42

That's plenty to start with, thanks 🙂

👍 1