Skip to content

Commit 24ea272

Browse files
committed
Update readme
1 parent 542decc commit 24ea272

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

Diff for: README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,37 @@
44

55
This package implements an opinionated set of bindings over [React](https://reactjs.org), optimizing for correctness and simplifying basic use cases.
66

7+
_A note about React hooks: Hooks are arriving in stable React soon. The API presented here is the more traditional `setState`+lifecycles style React's had for a long time. If you'd like to experiment with the hooks API in react-basic, have a look at [react-basic-hooks](https://github.com/spicydonuts/purescript-react-basic-hooks). It can be installed and used along side this library, but don't forget it's a preview release!_
8+
79
## Features
810

911
- All React DOM elements and attributes are supported (soon, events are a work in progress).
1012
- An intuitive API for specifying props - simple records, no arrays of key value pairs.
1113
- Attributes are optional, but type-checked. It is a type error to specify `href` as an integer, for example.
12-
- An action/update pattern for local component state, inspired by [ReasonReact](https://reasonml.github.io/reason-react/).
14+
- Both `setState` and an action/update pattern for local component state, inspired by [ReasonReact](https://reasonml.github.io/reason-react/).
1315
- React lifecycles are available, but not in your way when you don't need them.
14-
- Typeclasses, like `Eq props`, can be used in component definitions.
1516

1617
## Getting Started
1718

1819
You can install this package using Bower:
1920

2021
```sh
21-
bower install purescript-react-basic
22+
bower install --save purescript-react-basic
2223
```
2324

2425
Or clone/fork the [starter project](https://github.com/lumihq/react-basic-starter).
2526

26-
See [the documentation](https://pursuit.purescript.org/packages/purescript-react-basic/docs/React.Basic) for a detailed overview, or take a look at one of the examples:
27+
See [the documentation](https://pursuit.purescript.org/packages/purescript-react-basic/docs/React.Basic) for an overview of the API or take a look at these examples:
2728

28-
- [A Counter](./examples/counter/src/Counter.purs)
29+
- [A counter](./examples/counter/src/Counter.purs)
2930
- [A controlled input](./examples/controlled-input/src/ControlledInput.purs)
3031
- [Components](./examples/component/src/ToggleButton.purs) in [components](./examples/component/src/Container.purs)
32+
- [Using action/update](./examples/actions/src/Actions.purs)
33+
34+
## Migrating from v7 to v8
35+
36+
v8 removes the required `update` function from the component spec and replaces `send self Action` with the `self.setState` API. Existing components using `update` can create a `send` function using the `runUpdate` function added in v8. See [the actions example](./examples/actions/src/Actions.purs) for an example of this. Alternatively, [this comment](https://github.com/lumihq/purescript-react-basic/pull/73#issuecomment-456486249) shows a few other possible upgrade paths.
3137

32-
## Migrating from v2 or v3
38+
## Migrating from v2/v3
3339

3440
`React.Basic.Compat` is a new (but deprecated) module. It matches most of the old API and types (except `setStateThen` and `isFirstMount`) to make upgrading easier and more gradual. You can find `^import\sReact\.Basic\b` and replace with `import React.Basic.Compat`, upgrade the package version, and proceed from there one component at a time (or only new components). See the documentation link above for more info on the new API.

Diff for: package-lock.json

+12-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"scripts": {
1010
"build": "pulp build && npm run build:examples",
1111
"build:examples": "PATH=`echo $PATH | sed -e 's/:\\.\\/node_modules\\/\\.bin//'` find examples -maxdepth 2 -type f -iname makefile -execdir make \\;",
12+
"audit:examples": "PATH=`echo $PATH | sed -e 's/:\\.\\/node_modules\\/\\.bin//'` find examples -maxdepth 2 -type f -iname makefile -execdir npm audit fix \\;",
1213
"test": "npm run build"
1314
},
1415
"repository": {

0 commit comments

Comments
 (0)