![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@nion/nion
Advanced tools
nion is a library that makes it easy to fetch, update, and manage API data in a Redux store as well as bind it to React components. Nion strives to make working with data as **flexible**, **consistent**, and **predictable** as possible. 💖
nion is a library that makes it easy to fetch, update, and manage API data in a Redux store as well as bind it to React components. Nion strives to make working with data as flexible, consistent, and predictable as possible. 💖
nion is heavily inspired by Apollo and GraphQL.
nion is used as a decorator function which declares what data will be managed by the decorated component and passes in props for managing that data.
@nion({
currentUser: {
endpoint: 'https://patreon.com/api/current_user',
}
})
class UserContainer extends Component {
render() {
const { currentUser } = this.props.nion
const { request, actions, data } = currentUser
const loadButton = <Button onClick={() => actions.get()}>Load</Button>
return (
<Card>
{ request.isLoading ? <LoadingSpinner /> : loadButton }
{ exists(currentUser) ? <UserCard user={data} /> : null }
</Card>
)
}
}
We simply pass in an object with a special declaration
that tells nion what to fetch, and nion automatically handles fetching the data and passing both it and the corresponding request status in as props to the decorated component.
Read more about how nion works in the docs.
nion requires redux-thunk
in order to handle its async actions, so you should install that along with the nion
package.
npm install nion redux-thunk --save
Also, nion is best used as a decorator function, so you might also want to make sure you've got babel configured to handle decorator transpilation:
npm install babel-plugin-transform-decorators-legacy --save-dev
Finally, nion has to be wired up to the redux store and optionally configured. Here's a very simple setup:
import { applyMiddleware, createStore, combineReducers } from 'redux'
import thunkMiddleware from 'redux-thunk'
import { configureNion } from 'nion'
export default function configureStore() {
const configurationOptions = {}
const { reducer: nionReducer } = configureNion(configurationOptions)
const reducers = combineReducers({
nion: nionReducer,
})
let store = createStore(reducers, applyMiddleware(thunkMiddleware))
return store
}
Read more about configuring nion in the docs.
FAQs
nion is a library that makes it easy to fetch, update, and manage API data in a Redux store as well as bind it to React components. Nion strives to make working with data as **flexible**, **consistent**, and **predictable** as possible. 💖
The npm package @nion/nion receives a total of 11 weekly downloads. As such, @nion/nion popularity was classified as not popular.
We found that @nion/nion demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.