You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-4Lines changed: 30 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,36 @@ This is an experimental implementation of React hooks on [react-basic](https://g
6
6
It's here to allow experimentation while we get feedback on the API and wait for an official React release which supports hooks.
7
7
For more info on hooks, see [React's documentation](https://reactjs.org/docs/hooks-intro.html).
8
8
9
-
It's also recommended while using this module to use PureScript's new "qualified do" syntax (it's used in the examples, `React.do`).
10
-
It's available in the `0.12.2` release.
9
+
I recommend using PureScript's new "qualified do" syntax while using this library (it's used in the examples, the `React.do` bits).
10
+
It's available in the `0.12.2`compiler release.
11
11
12
-
If we prefer this API over the existing react-basic API, we may eventually replace it with this.
12
+
This library provides the `React.Basic.Hooks` module, which can completely replace the `React.Basic` module.
13
+
It borrows a few types from the current `React.Basic` module like `ReactComponent` and `JSX` to make it easy to use both versions in the same project.
14
+
If we prefer this API over the existing react-basic API, we may eventually replace `React.Basic` with this implementation.
13
15
14
-
*A note on Refs:* The `Ref` type is useful for passing to DOM nodes, but while this module remains a small extension to the existing react-basic library it won't be possible to pass a `ref` prop to the native DOM components.
- Components: [Parent](./examples/component/src/Container.purs) and [Child](./examples/component/src/ToggleButton.purs)
36
+
-[Refs to DOM nodes](./examples/refs/src/Refs.purs) (and extracting hook logic from a component for reuse)
37
+
-[A Todo App](./examples/todo-app/src/TodoApp.purs) (components, inputs, state)
38
+
39
+
*A note on Refs:* The `Ref` type is useful for all kinds of state (anything which shouldn't trigger a render when changed), particularly references to DOM nodes as in the example.
40
+
Unfortunately, while this module remains a small extension to the existing react-basic library it won't be possible to pass a `ref` prop to the native DOM components from `React.Basic.DOM`.
15
41
In the meantime, use `element (unsafeCreateDOMComponent "div") { ref: elementRef }`.
0 commit comments