codestates / codestates/M4M

[Guide] Notification 사용 가이드

Open
#91 0 comments 0 reactions 1 assignee Claimed by @magababo View on GitHub
guide
Dominant language
JavaScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### Notification 사용 가이드 안내

1. Notification을 사용하고 싶은 file로 이동한다.
2. 아래와 같은 내용을 import 한다.
```js
import { notify } from '../redux/action'; // ! from relocation needed
import { useSelector, useDispatch } from 'react-redux';
```
3. component function 안에 selector, dispatch를 불러온다.
```js
function example () {
const notiState = useSelector(state => state.notiReducer).notifications;
const dispatch = useDispatch();
return ( ... )
}
```
4. notfication을 원하는 장소에 아래와 같은 format을 넣고, 원하는 text를 입력한다.
```js
if (notiState.message === '') {
dispatch(notify('검색창이 비었습니다. 추억을 입력해주세요! ᕕ( ᐛ )ᕗ'));
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.