react-io v5.3.0
react-io
React bindings for url-io Request and mutate data using a standard interface passed through React context.
Passing IO through context
Adds IO to context. Use once at the root of your app.
import React from 'react'
import {IOProvider} from 'react-io'
import io from './io'
export default function App() {
return <IOProvider io={io}>
...
</IOProvider>
}
withIO(urls)(WrappedComponent)
Returns a higher-order-component (HOC) that pulls io from context and passes it to the wrapped component as a prop.
Pass it a map of urls or a mapper to turn props into a map of urls and it will add the resolved values to the prop stream.
import {withIO, render} from 'react-io'
export default withIO({
auth: '/auth'
})(function Widget({io, auth}) {
return auth ?
<div>{auth.username}</div>) :
<div>Not authorized</div>
})
3 months ago
3 months ago
8 months ago
8 months ago
8 months ago
8 months ago
11 months ago
2 years ago
2 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago