Skip to content

Commit

Permalink
fix: docs typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Miłosz Mandowski committed Oct 4, 2021
1 parent 25b4cbe commit 5811b46
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/component-decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class extends Component {
@watchEffect()
updateCounterText() {
this.counterText = `Current counter value: ${this.counter}`;
this.$el.innerHTML = this.counterText;
this.$element.innerHTML = this.counterText;
}

init() {
Expand Down
2 changes: 1 addition & 1 deletion docs/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default class extends Component {
}
```

Notice, that we don't have to remove those listeners. When component is destroying, they would be automatically removed. If you would like to remove listener earlier, for any reason, you an do it manually by using `$off`. Decorator `@bind` uses `$on` internally.
Notice, that we don't have to remove those listeners. When component is being destroyed, they are automatically removed. If you would like to remove listener earlier, for any reason, you can do it manually by using `$off`. Decorator `@bind` uses `$on` internally.

Full signature for methods `$on` and `$off`:

Expand Down
12 changes: 7 additions & 5 deletions docs/reactivity/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Here you can find API with list of all available tools for reactivity and links

Now, let's jump to some examples!

## Building dialog system
## Example: Building dialog system

Let's say you have a lot of dialogs and would like to keep and manage them in one, global place. We can start with singleton class:

Expand Down Expand Up @@ -59,15 +59,15 @@ export class DialogSystem {
}
```

We used our first reactivity tool: `ref`. It creates reactive object with field `.value`. If reference under `.value` changes, we would now. Example:
We used our first reactivity tool: `ref`. It creates a reactive object with the field `.value`. If reference under `.value` changes, we would now. Example:

```js
const arr = ref([1, 2, 3])

arr.value = [1, 2, 3] // <- this will trigger a change!
```

Coming back to our example! Let's add a method, that allow us to create dialogs!.
Coming back to our example! Let's add a method, that allows us to create dialogs!.

```js
import { ref, markRaw } from 'ovee.js';
Expand Down Expand Up @@ -150,7 +150,7 @@ This just a core concept, where you can optioanlly transform it into an `Ovee.js

Let's take a look on one more example: global state management.

## Building your own state managment system (store)
## Example: Building your own state management system (store)

In frameworks like `Vue` or `React`, there is often some sort of a global state management tool. In `React`, it's `Flux`, and in `Vue` it's `Vuex`. But you can make something much simpler for you small needs with little to none effort! Let's create an object that would store fetched posts.

Expand All @@ -169,7 +169,9 @@ export const postsStore = makeReactive({
})
```

Now we use `makeReactive` to create reactive object that can track changes of it's fields. Wi initialized `posts` field, to keep out posts and created to computeds: `getPostsByUserId`, that returns a function which than, based on passed id and state, returns different values, and `readPosts` that always returns only `read` posts.
Now we use `makeReactive` to create a reactive object that can track changes in it's fields. We initialized `posts` field, to keep our posts and created two computeds:
- `getPostsByUserId`, that returns a function which than, based on passed `id` and state, returns different values
- `readPosts` that always returns only `read` posts

Now we can use it in our component, especially cool in `TemplateComponent`:

Expand Down

0 comments on commit 5811b46

Please # to comment.