Skip to content

Commit

Permalink
chore(readme): updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
BowlingX committed Dec 4, 2019
1 parent e758a34 commit 2cccb03
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
# Geschichte

![CircleCI](https://img.shields.io/circleci/build/gh/BowlingX/geschichte)
![Codecov](https://img.shields.io/codecov/c/github/bowlingx/geschichte)
![npm](https://img.shields.io/npm/v/geschichte)

Let's you manage query-parameters with hooks. Uses `immer` and `zustand` to manage the internal state.

## Example
Documentation: https://bowlingx.github.io/geschichte/index.html

API: https://bowlingx.github.io/geschichte/api/index.html

yarn add geschichte

npm install geschichte

## Basic Example

```typescript jsx

import { pm, factoryParameters, serializers } from 'geschichte'

const parameterConfig = {
your: {
object: {
somewhere: pm('queryParameter', serializers.string)
}
}
item: pm('queryParameter', serializers.string)
};

const defaultValue = {
your: {
object: {
somewhere: 'defaultValue'
}
}
item: 'defaultValue'
}


Expand All @@ -31,8 +35,8 @@ const Component = () => {
const { values, pushState, replaceState } = useQuery()
return (
<>
<button onClick={() => pushState((values) => void ( values.your.object.somewhere = "newValue" ))}>push new state</button>
<button onClick={() => replaceState((values) => void ( values.your.object.somewhere = "anotherOne" ))}>replace state</button>
<button onClick={() => pushState((values) => void ( values.item = "newValue" ))}>push new state</button>
<button onClick={() => replaceState((values) => void ( values.item = "anotherOne" ))}>replace state</button>
<div>{JSON.stringify(values)}</div>
</>
)
Expand Down

0 comments on commit 2cccb03

Please sign in to comment.