5.2.0 β€’ Published 10 months ago

@cervello/react v5.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Cervello

npm version bundle-size

🀯 Simple, reactive, tiny and performant state-management library for React (just 1.5kb)

πŸš€ Features

  • βš›οΈ Reactive with store object changes (nested properties too πŸš€!!)
  • βœ… Simple & minimalistic API
  • πŸš€ Batched updates and optimized re-renders
  • 🐨 Lazy listen nested properties
  • πŸ”’ Immutable changes
  • πŸ”‘ Typescript support

πŸ“¦ Install

# NPM
npm install @cervello/react

# PNPM
pnpm add @cervello/react

# YARN
yarn add @cervello/react

πŸ’» Quick Usage

It's as simple as reassign a new value to the store properties. It will notify all the components using useStore hook to re-render with the new value.

// - store-example.ts
import { cervello } from '@cervello/react'

export const {
  store,       // Object with reactive changes
  useStore,    // Hook to listen for store or partial store changes
  reset,       // Function to reset the store to initial value
} = cervello({
  fullName: 'Cervello Store',
  address: {
    city: 'Huelva',
    /* ... */
  },
})


// Change value from anywhere
store.address.city = 'Sevilla'


// Listen for changes from components
function Address() {
  const { address } = useStore()
  return (<p>City: {address.city}</p>)
}


// Just listen for changes in the `city` property
const AddressWithSelector = () => {
  const { address } = useStore({
    select: ['address.city']
  })

  return (<p>City: {address.city}</p>)
}

To see more in depth explanations or API references and more examples: πŸ“– Documentation website


Created with Typescript! ⚑ and latin music 🎺🎡

5.1.0

11 months ago

5.0.0-beta.8

11 months ago

5.0.0-beta.9

11 months ago

5.0.0-beta.6

11 months ago

5.0.0-beta.7

11 months ago

5.0.0-beta.4

11 months ago

5.0.0-beta.5

11 months ago

5.0.0-beta.2

11 months ago

5.0.0-beta.3

11 months ago

5.0.0-beta.1

12 months ago

5.0.0-beta.11

11 months ago

5.0.0-beta.10

11 months ago

5.2.0

10 months ago

5.0.0

11 months ago

5.2.0-beta.0

10 months ago

5.1.0-beta.1

11 months ago

5.1.0-beta.2

11 months ago

5.1.0-beta.7

11 months ago

5.1.0-beta.8

11 months ago

5.1.0-beta.9

11 months ago

5.1.0-beta.3

11 months ago

5.1.0-beta.4

11 months ago

5.1.0-beta.5

11 months ago

5.1.0-beta.6

11 months ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

0.11.8

4 years ago

0.11.0

4 years ago

0.12.0

4 years ago

0.11.1

4 years ago

0.11.2

4 years ago

0.10.3

4 years ago

0.12.2

3 years ago

0.11.3

4 years ago

0.10.4

4 years ago

0.11.4

4 years ago

0.11.5

4 years ago

0.11.6

4 years ago

0.11.7

4 years ago

0.10.2

4 years ago

0.10.1

4 years ago

0.10.0

4 years ago

0.9.6

4 years ago

0.9.5

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago