Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 1.72 KB

README.md

File metadata and controls

59 lines (45 loc) · 1.72 KB

Declarative State & Side-effect management with CerebralJS

Use CerebralJS to manage an apps state and side effects in a declarative manner:

Declarative CerebralJS:

;[
  setLoading(true),
  getUser,
  {
    success: setUser,
    error: setError,
  },
  setLoading(false),
]

vs imperative JS:

function getUser() {
  this.isLoading = true
  ajax
    .get('/user')
    .then((user) => {
      this.data = user
      this.isLoading = false
    })
    .catch((error) => {
      this.error = error
      this.isLoading = false
    })
}

Deploy your own

Deploy the example using Vercel or preview live with StackBlitz

Deploy with Vercel

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example with-cerebral with-cerebral-app
yarn create next-app --example with-cerebral with-cerebral-app
pnpm create next-app --example with-cerebral with-cerebral-app

Deploy it to the cloud with Vercel (Documentation).