Commit 94f9dec2 authored by James Laver's avatar James Laver

v0.3.0

parent 02645d68
# purescript-reactix # purescript-reactix
A minimal purescript binding to React Hooks A minimal, modern react binding focusing on ease-of-use
## Status: alpha ## Status: alpha
Features are being added and tested as I need them for work. Features are being added and tested as I need them for work.
Hooks believed to work correctly: Hooks believed to work correctly (including variants)
* `useState` * `useState`
* `useReducer`
* `useContext`
* `useRef`
* `useEffect` * `useEffect`
* `useLayoutEffect` * `useLayoutEffect`
* `useRef`
## Rationale ## Rationale
...@@ -35,8 +37,8 @@ Hooks are IMHO a breakthrough feature. They're simple to reason about ...@@ -35,8 +37,8 @@ Hooks are IMHO a breakthrough feature. They're simple to reason about
and they're low on boilerplate. They make React programming much more and they're low on boilerplate. They make React programming much more
fun and productive and I never want to touch a class component again. fun and productive and I never want to touch a class component again.
Reactix is a Hooks-first (Hooks-only?) React library focusing on Reactix is a modern, Hooks-first React library focusing on simplicity
simplicity and ease-of-use. and ease-of-use.
<!-- ## Tutorial --> <!-- ## Tutorial -->
...@@ -57,38 +59,68 @@ If you already use `purescript-react-basic`, you may prefer ...@@ -57,38 +59,68 @@ If you already use `purescript-react-basic`, you may prefer
[purescript-react-basic-hooks](https://github.com/spicydonuts/purescript-react-basic-hooks), [purescript-react-basic-hooks](https://github.com/spicydonuts/purescript-react-basic-hooks),
a similar library implemented on top of `purescript-react-basic`. a similar library implemented on top of `purescript-react-basic`.
## TODO ## TODO
* DOM Not in any particular order
* safe props
* Synthetic Events 1. Safe DOM props:
* Come up with a testing strategy * Make sure each element only takes the correct props
* What do do about event targets? * Translate some props with minimal and efficient wrapping
* Implement remaining 2. Refs
* React * Test forwardRef
* Refs 3. Context
* isValid (test) * Test consumer (we only test useContext right now)
* context (createContext, provider, consumer, provide, consume) 4. Misc hooks
* Hooks * Test useEffect/useLayoutEffect are fired at the correct stage
* useEffect/useLayoutEffect * Test useMemo/useCallback
* Test they're fired at the correct stage * Test useImperativeHandle
* useReducer * Test useDebugValue
* Tests * Test React.isValid
* useMemo 5. Move to `Aff` instead of `Effect`
* Tests
* useCallback
* Tests
* useRef
* Tests
* useContext
* Tests
* useImperativeHandle
* Tests
* useDebugValue
* Tests
## Changelog ## Changelog
<!-- ### NEXT -->
<!-- Newly supported functions: -->
<!-- * `R.React.consumeContext` -->
<!-- * `R.React.provide` - provider a value through a `Provider` -->
<!-- * `R.React.consume` - consume a value through a `Consumer` -->
### 0.3.0
Newly supported hooks and variants:
* `R.Hooks.useReducer`
* `R.Hooks.useReducer'` (`useReducer` with a constant initial value)
* `R.Hooks.useContext`
* `R.Hooks.useState'` (`useState` with a constant initial value)
* `R.Hooks.useEffect[1-5]'` (`useEffect` with no cleanup function)
* `R.Hooks.useLayoutEffect[1-5]'` (`useLayoutEffect` with no cleanup function)
Newly supported functions:
* `R.React.createContext` - create a `Context` with a default value
* `R.React.provideContext` - provide a `Context` a value to some children
* `R.React.provider` - get a `Provider` for a `Context`
* `R.React.consumer` - get a `Consumer` for a `Context`
* `R.Hooks.nothing` - an empty cleanup function
* `R.Hooks.thenNothing` - make an effect function return an empty cleanup function
Bug Fixes:
* `R.React.render` was broken because the tests don't use it and
neither does the main consumer of this project where it gets put
through its paces
Misc:
* First attempts at all remaining hook functions have been written and
not tested. Don't be surprised if they don't work.
* Remove foreign javascript file for `R.Hooks` in favour of `ffi-simple`
### 0.2.0 ### 0.2.0
* Make SyntheticEvent parameterised by a native event * Make SyntheticEvent parameterised by a native event
...@@ -107,8 +139,8 @@ a similar library implemented on top of `purescript-react-basic`. ...@@ -107,8 +139,8 @@ a similar library implemented on top of `purescript-react-basic`.
Supported Hooks: Supported Hooks:
* `useState` * `useState`
* `useEffect` * `useEffect[1-5]?`
* `useLayoutEffect` * `useLayoutEffect[1-5]?`
Notable changes: Notable changes:
......
{ {
"name": "reactix", "name": "reactix",
"version": "0.1.0", "version": "0.3.0",
"description": "", "description": "",
"scripts": { "scripts": {
"rebase-set": "spago package-set-upgrade && spago psc-package-insdhall",
"rebuild-set": "spago psc-package-insdhall", "rebuild-set": "spago psc-package-insdhall",
"install-ps": "psc-package install", "install-ps": "psc-package install",
"repl": "pulp --psc-package repl",
"build": "pulp browserify -I test --main Test.Main > output/bundle.js", "build": "pulp browserify -I test --main Test.Main > output/bundle.js",
"test": "karma start" "test": "karma start"
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment