Reagent uses a datastructure known as Hiccup to describe HTML. Hiccup describes HTML elements and user-defined components as a nested ClojureScript vector:
```clojure
[:div {:class "parent"}
[:p {:id "child-one"} "I'm first child element."]
[:p "I'm the second child element."]]
```
As described below, reagent provides a number of extensions and conveniences to Hiccup, but the general rules of Hiccup are as follows:
1. The first element is either a keyword or a symbol
* If it is a keyword, the element is an HTML element where `(name keyword)` is the tag of the HTML element.
* If it is a symbol, reagent will treat the vector as a component, as described in the next section.
2. If the second element is a map, it represents the attributes to the element. The attribute map may be omitted.
3. Any additional elements must either be Hiccup vectors representing child nodes or string literals representing child text nodes.
## Special treatment of `nil` child nodes
Reagent and React ignore nil nodes, which allow conditional logic in Hiccup forms:
```clojure
(defn my-div [child?]
[:div
"Parent Element"
(when child? [:div "Child element"])])
```
In this example `(my-div false)` will evaluate to `[:div "Parent Element" nil]`, which reagent will simply treat the same as `[:div "Parent Element"]`.
## Special interpretation of `style` attribute
The `:style` attribute can be written a string or as a map. The following two are equivalent:
The map form is the same as [React's style attribute](https://reactjs.org/docs/dom-elements.html#style), except that when using the map form of the style attribute, the keys should be the same as the CSS attribute as shown in the example above (not in camel case as is required JavaScript).
1. A Hiccup vector. Reagent creates a React component with the function as its render method and uses the Hiccup vector for the initial render.
2. A ClojureScript function. Reagent will then create a React component with this inner function as the render method and will then call the inner function for the initial render.
3. A React component. Reagent will render this using React.createElement. Note, this could be a result of calling `reagent.core/create-class` or it could be a React component you have imported from a JavaScript library.