Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dbritto-dev committed Jun 13, 2024
1 parent 370dfab commit fc886f1
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/reference/combine.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: combine
description:
nav: 200
nav: 201
---

# combine
Expand Down
71 changes: 71 additions & 0 deletions docs/reference/core-concepts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Core Concepts
description:
nav: 200
---

# Core Concepts

## Store

The Store lets you access to the store API utilities.

## API Utilities

These store API utilities are: `setState` function, `getState` function, and `subscribe` function.

### `setState` function

The `setState` function lets you update the state to a different value and trigger re-render. You
can pass the next state directly, a next partial state, a function that calculates it from the
previous state, or replace it completely.

#### Parameters

- `nextState`: The value that you want the state to be. It can be a value of any type, but there is
a special behavior for functions.
- If you pass an object as a `nextState`. It will shallow merge `nextState` with the current
state. You can pass only the properties you want to update, this allows for selective state
updates without modifying other properties.
- If you pass a non-object as a `nextState`, make sure you use `replace` as `true` to avoid
unexpected behaviors.
- If you pass a function as a `nextState`. It must be pure, should take current state as its
only argument, and should return the next state. The next state returned by the updater
function face the same restrictions of any next state.
- `replace`: This optional boolean flag controls whether the state is completely replaced or only
shallow updated, through a shallow merge.

#### Returns

`setState` function do not have a return value.

### `getState` function

The `getState` function lets you access to the current state. It can be stale on asynchronous
operations.

### `subscribe` function

The `subscribe` function lets you subscribe to state updates. It should take current state, and
its previous state as arguments.

#### Parameters

- `currentState`: The current state.
- `previousState`: The previous state.

#### Returns

`subscribe` returns a function that lets you unsubscribe from itself.

### Selector

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Vel veritatis alias saepe vitae placeat
blanditiis laborum, asperiores architecto explicabo unde. Cum sint vero veritatis. Hic ipsum quis
saepe voluptates temporibus!

### Bound Hook

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Minus quas sequi, similique corrupti iure
incidunt autem. Voluptas eum atque harum! Assumenda natus, animi doloribus facilis maiores dicta
iusto ipsa earum.
3 changes: 2 additions & 1 deletion docs/reference/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ devtools<T>(stateCreatorFn: StateCreator<T, [], []>, devtoolsOptions?: DevtoolsO
arguments.
- **optional** `devtoolsOptions`: An object to define Redux DevTools options.
- **optional** `name`: A custom identifier for the connection in the Redux DevTools.
- **optional** `enabled`: Defaults to `true`. Enables or disables the Redux DevTools integration
- **optional** `enabled`: Defaults to `true` when is on development mode, and defaults to `false`
when is on production mode. Enables or disables the Redux DevTools integration
for this store.
- **optional** `anonymousActionType`: Defaults to `anonymous`. A string to use as the action type
for anonymous mutations in the Redux DevTools.
Expand Down

0 comments on commit fc886f1

Please sign in to comment.