![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A lightweight, type-safe state management solution designed to make React state simple
Igris is a small, simple, and type-safe state management solution for React and React Native. It offers efficient data persistence and seamless integration with various storage mechanisms. Designed to be lightweight and intuitive, Igris helps developers manage application state with ease and confidence.
Install Igris using npm:
npm install igris
Or using yarn:
yarn add igris
import React from 'react';
import { createStore, createState } from 'igris';
// Create a new instance of the store with initial state and actions
export const useCount = createStore(
{ count: 0 },
({ set, get }) => ({
increment: () => set({ count: get().count + 1 }),
decrement: () => set({ count: get().count - 1 }),
})
);
// Component using the entire store
const CounterComponent = () => {
const { count, decrement, increment } = useCount();
return (
<div>
<p>Count: {count}</p>
<button onClick={increment}>Increment</button>
<button onClick={decrement}>Decrement</button>
</div>
);
};
// Component using a selector for state
const CountDisplayComponent = () => {
const count = useCount((state) => state.count);
return <p>Count: {count}</p>;
};
// Component using a selector for actions
const CountActionsComponent = () => {
const { increment, decrement } = useCount((state) => ({
increment: state.increment,
decrement: state.decrement,
}));
return (
<div>
<button onClick={increment}>Increment</button>
<button onClick={decrement}>Decrement</button>
</div>
);
};
export const useDarkTheme = createState(true);
const ThemeComponent = () => {
const [isDark, setDark] = useDarkTheme();
return (
<div>
<p>Current Theme: {isDark ? 'Dark' : 'Light'}</p>
<button onClick={() => setDark(true)}>DARK</button>
<button onClick={() => setDark(false)}>LIGHT</button>
</div>
);
}
createStore(initialState, actions)
Creates a new store with the given initial state and actions.
initialState
: An object representing the initial state of the store.actions
: A function that receives set
and get
methods and returns an object of actions.createState(initialValue)
Creates a new state hook with the given initial value.
initialValue
: The initial value of the state.For comprehensive usage examples and detailed API documentation, please visit our official documentation site.
We welcome contributions from the community! If you encounter any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request on the Igris GitHub repository.
If you find Igris helpful, consider supporting its development:
Your support helps maintain and improve Igris for the entire community.
This project is licensed under the MIT License.
Made with ❤️ by Alok Shete
FAQs
A lightweight, type-safe state management solution designed to make React state simple
The npm package igris receives a total of 0 weekly downloads. As such, igris popularity was classified as not popular.
We found that igris demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.