-
Sorry if I do not understand at all. I'm just testing something on this framework and instantly have this question. The first way: The second way:
each time I need to use it it does not clean in my opinion
So if I want to define a custom event like element click outside, how can I do it with vanilla Javascript in Nue to be reusable on both elements and components in the best way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Not sure what your goal is but nothing stops you from adding a global event listener to target specific elements. For example: document.addEventListener('click', (event) => {
if (event.target.tagName == 'DIV') {
// do your thing
}
}) |
Beta Was this translation helpful? Give feedback.
Nue JS is, similar to React, a library for building reactive components — so features like those are outside of its context. This kind of click handlers should be implemented with Web Components and/or Vanilla JS. There will be examples once the design system parts are finished and Nue moves forward to reactivity and single-page applications.