https://github.com/a7ul/use-redux-hook
A simple react hook to get access to redux store
https://github.com/a7ul/use-redux-hook
hooks javascript openlibrary react react-hook redux
Last synced: about 1 month ago
JSON representation
A simple react hook to get access to redux store
- Host: GitHub
- URL: https://github.com/a7ul/use-redux-hook
- Owner: a7ul
- Created: 2019-02-18T10:26:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-18T14:18:09.000Z (over 6 years ago)
- Last Synced: 2025-04-05T02:22:29.195Z (2 months ago)
- Topics: hooks, javascript, openlibrary, react, react-hook, redux
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/use-redux-hook
- Size: 3.91 KB
- Stars: 13
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# use-redux-hook
[](https://badge.fury.io/js/use-redux-hook)
**A simple react hook to get access to redux store**
# Pre-requisite
**Needs:**
- react > 16.8,
- react-redux > 6.0.0# Use cases
Currently only way to get access to redux is via the connect HOC. There is no clean way to do it the hook way.
This module is a tiny hook that gives out redux store# Install
```
npm install use-redux-hook
```or
```
yarn add use-redux-hook
```# Usage
### Basic
**Simple use case**
```js
import React from "react";
import { useReduxStore } from "use-redux-hook";export const ExampleReactComponent = () => {
const {getState, dispatch} = useReduxStore();
const { user } = getState();
returnHello {user.name};
};
```