In ClojureScript, is there a difference between using [:div] and [:<>]?
- User
In ClojureScript, is there a difference between using [:div] and [:<>]?
- Assistant
In ClojureScript, especially when working with React via a library like Reagent,
[:div]and[:<>]are both ways to define elements in Hiccup syntax, but they represent different things.[:div]is a Hiccup shorthand for creating a<div>HTML element. It is analogous to writing<div></div>in HTML.On the other hand,
[:<>]is not standard Hiccup or HTML syntax and is not used in vanilla ClojureScript Hiccup. However, this syntax seems to be inspired by the React concept of Fragments. In React (with JSX), is a shorthand syntax for .