> For the complete documentation index, see [llms.txt](https://atomico.gitbook.io/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atomico.gitbook.io/doc/guides/atomico-and-react/from-react-to-atomico/virtualdom-api-differences.md).

# VirtualDOM api differences

Atomico's virtualDOM is:

1. Close to standard DOM .
2. Additional coverage to webcomponents.

### Components as constructors

Atomico does not support the use of functions to instantiate the component as we traditionally do in React, so that the component can be instantiated as a constructor it must be a webcomponent or a real Node.

{% tabs %}
{% tab title="❌ Not supported" %}

```jsx
function Component(){
    const [ state, setState ] = useState();
    return <host></host>
}

function App(){
    return <host>
        <Component/>
    </host>
}
```

{% endtab %}

{% tab title="✔️ Spported" %}

```jsx
// ⚠️ stateless component
function Component(){ 
    return <host></host>
}

function App(){
    return <host>
        <Component/>
    </host>
}
```

{% endtab %}

{% tab title="✔️ Spported" %}

```jsx
function component(){
    return <host></host>
}

const Component = c(component);
customElements.define("my-component",Component)

function app(){
    return <host>
        <Component/>
    </host>
}
```

{% endtab %}

{% tab title="✔️ Supported" %}

```jsx
function app(){
    const Div = document.createElement("div");
    return <host>
        <Image/>
        <Div/>
    </host>
}
```

{% endtab %}
{% endtabs %}

### Event Association

Like React in Atomico you need to use the prefix on to announce an event, but there is a difference **Atomico does not manipulate the name of the event so `onClick` is different from `onclick`**, the purpose of this difference is to support custom events.

```jsx
<div>
    <button onclick={console.log}>click</button>
    <button onMyCustomEvent={console.log}>click</button>
    <button onmy-event={console.log}>click</button>
    <button onmouseover={console.log}>click</button>
</div>
```

### Keyes

the `key` property in Atomicoo can be of type String, Number, Symbol or other immutable reference.

```jsx
<div>
    <div key={1}>1</div>
    <div key={symbol}>1</div>
    <div key={immutable}>1</div>
</div>
```

### dangerouslySetInnerHTML

```jsx
<div innerHTML={`<h1>html!</h1>`}/>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://atomico.gitbook.io/doc/guides/atomico-and-react/from-react-to-atomico/virtualdom-api-differences.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
