Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
A dead simple 1.3kb store for React
# yarn
yarn add agestor
# npm
npm i agestor
// App.js
import React from 'react'
import createStore from 'agestor/createStore'
const initialValue = {
luckyNumber: 15,
capital: { colorado: 'Denver' }
}
const App = () => <h1>My App</h1>
export default createStore(App, initialValue)
You can pass the initial store value as the second argumento of the function createStore
props.store.get('key')
// MyComponent
import React from 'react'
import withStore from 'agestor/withStore'
const MyComponent = ({ store }) => (
<p>Lucky number: {store.get('luckyNumber')}</p>
// You can also get nested values
<p>The capital of colorado is: {store.get('capital')[colorado]}</p>
)
export default withStore(MyComponent)
const { store } = props
store.set({ key: 'value' })
store.set({ anotherKey: { name: 'AnotherValue' } })
const { store } = props
const exampleKey = store.get('exampleKey')
const defaultValue = { name : 'an optional default value if the key is not found' }
const another_key = store.get('another_key', defaultValue)
const { store } = props
store.remove('a_key')
// All your data in on the store variable
const { store } = props
Using an object with the key
and the value
properties: { key: 'key', value: theValue }
const { store } = props
const firstObject = { key: 'key-one', value: 'value-one' }
const secondObject = { key: 'key-two', value: 'value-two' }
store.setAll(firstObject, secondObject)
When creating the store with createStore
you can pass the store initial value:
const initialValue = {
someKey : 'some value',
anotherKey : {
name : 'my initial value'
}
}
export default createStore(App, initialValue)
FAQs
> A dead simple 1.3kb store for React
The npm package agestor receives a total of 0 weekly downloads. As such, agestor popularity was classified as not popular.
We found that agestor 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.