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.
react-purify
Advanced tools
helper functions and decorators for purification of react components with global dependencies and context. Simplifies the implementation of a flux-architecture
This handy ES7 decorators makes it easy to implement (or migrate gradually) your react-components to a flux-like architecture. Goal of this library is empowering users to purify components quickly without breaking existing architectures.
import {pure,mix} form 'react-purify'
@pure() // pureRenderMixin
class MyPureComponent extends React.Component {
//...
}
//if you need more mixins :
@mix([LinkedStateMixin,PureRenderMixins,...])
class MyComp {
//...
}
import {UI,pureUI} form 'react-purify'
const MyPureComponent = pureUI( p=> (<h1>{p.title} </h1>) );
const MyImpureComponent = UI( p=>(<h1> {globalState} </h1>) );
var appState={todo:[/*...*/]};
import {inject,use} form 'react-purify'
@inject({appState}) // or @inject({appState:appState})
class TodoApp {
render(){
return <TodoList />
}
}
@use( // transfers context to props
['appState'], //get the appState
p=>({ //extract component dependencies
todo:p.appState.todo
})
)
@pure() // lets only redraw if todos have changed
class TodoList {
render(){
return <ul>{this.props.todo.map( (todo,k)=> <li key={k} >{todo}</li> )}</ul>
}
}
//The example above shows how you can gradually move dependencies. Following code is equivallent :
@inject({appState})
@use(['appState'],p=>(
{todo:p.appState.todo})
)
class TodoApp {
render(){
return <TodoList {...this.props.todo}/>
}
}
@pure()
class TodoList {
render(){
return <ul>{this.props.todo.map( (todo,k)=> <li key={k} >{todo}</li> )}</ul>
}
}
FAQs
helper functions and decorators for purification of react components with global dependencies and context. Simplifies the implementation of a flux-architecture
The npm package react-purify receives a total of 2 weekly downloads. As such, react-purify popularity was classified as not popular.
We found that react-purify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.