Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swiip/power-react
https://github.com/swiip/power-react
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/swiip/power-react
- Owner: Swiip
- Created: 2018-05-18T13:13:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-18T16:26:48.000Z (over 6 years ago)
- Last Synced: 2024-10-15T13:28:12.840Z (24 days ago)
- Language: JavaScript
- Size: 112 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Power React
Wrapper around React + Recompose + Styled Components + HyperX in order to get a homogeneous API.
Ohh... Its 30 LoC :)
# Example
```javascript
import {
html,
css,
component,
withState,
withHandlers,
withMarkup,
withStyle
} from "../lib";const Button = component(
withState("name", "setName", "World"),
withHandlers({
toggle: ({ name, setName }) => () =>
setName(name === "World" ? "Swiip" : "World")
}),
withStyle(
({ name }) => css`
color: ${name === "World" ? "black" : "red"};
`
),
withMarkup(
({ name, toggle, className }) => html`
Hello <${Green}>${name}${Green}>!
`
)
);
```