# Installing Declarativas in Your Application

## Installing

You can use nodejs and npm to grab the latest copy of declarativas to get going in seconds.

#### With npm or yarn

Open up your terminal, and do the usual:

```bash
$ npm install --save declarativas
# OR
$ yarn add declarativas
```

And bring it in your code:

{% code title="index.js" %}

```javascript
import { render, createElement as c, ClearCanvas, Properties, StrokeRect } from 'declarativas';

// Get your canvas from an HTML file.
const canvas = document.querySelector('canvas');

render(
  [
    c(ClearCanvas),
    c(Properties, { strokeStyle: 'black' }),
    c(StrokeRect, {
      x: 100,
      y: 100,
      w: 20,
      h: 20,
    })
  ]),
  canvas.getContext('2d'),
);
```

{% endcode %}

#### With a CDN

{% code title="index.html" %}

```markup
<!doctype html>
<html>
<body>
  <canvas></canvas>
  <!-- CDN Import -->
  <script type="javascript" src="https://unpkg.com/declarativas"></script>
  
  <!-- Code -->
  <script type="javascript">
    const { render, createElement as c, ClearCanvas, Properties, StrokeRect } = window.declarativas;
    const canvas = document.querySelector('canvas');

    render(
      [
        c(ClearCanvas),
        c(Properties, { strokeStyle: 'black' }),
        c(StrokeRect, {
          x: 100,
          y: 100,
          w: 20,
          h: 20,
        })
      ]),
      canvas.getContext('2d'),
    );
    
  </script>
</body>
</html>
```

{% endcode %}


---

# Agent Instructions: 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:

```
GET https://declarativas.mrbarry.com/getting-started/installing-declarativas-in-your-application.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
