Skip to content

Commit

Permalink
chore: readme updated
Browse files Browse the repository at this point in the history
  • Loading branch information
betula committed Oct 22, 2020
1 parent f359ce0 commit 90eba93
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Reactive state manager for React.

Imperative, Light, Fast and Pretty looked :kissing_heart:
Impressive, Light, Fast, and Pretty looked :kissing_heart:

### Usage

Expand All @@ -14,21 +14,22 @@ import axios from "axios";
import { unit, useOwn } from "realar";

const Todos = unit({
todos: [], // immutable store
todos: [], // Init immutable store
async fetch() {
const { data } = await axios.get("/api/todos");
this.todos = data; // update immutable store
this.todos = data; // Update immutable store
},
constructor() {
this.fetch();
},
// get completed() { // cached selector
// get completed() { // Cached selector
// return this.todos.filter(task => task.completed);
// },
});

const App = () => {
const { todos, fetch } = useOwn(Todos); // use own instance of Todos
// Use the own instance of Todos
const { todos, fetch } = useOwn(Todos);

if (fetch.pending) {
return (
Expand Down

0 comments on commit 90eba93

Please sign in to comment.