# Part 09
miroslav.binas@tuke.sk / [**SMART**](https://kurzy.kpi.fei.tuke.sk/smart)
## 26.nov. - 6.dec.
(main: 26.nov. - 3.dec.)
Turn On
[![Redux](../images/redux.png)](https://redux.js.org)
[![Flux](../images/flux.png)](https://facebook.github.io/flux/)
## Flux Architecture
[![Flux Architecture](https://krasimir.gitbooks.io/react-in-patterns/content/chapter-08/fluxiny_basic_flux_architecture.jpg)](https://krasimir.gitbooks.io/react-in-patterns/content/chapter-08/#flux-architecture-and-its-main-characteristics)
## Redux Architecture
[![Redux Architecture](https://krasimir.gitbooks.io/react-in-patterns/content/chapter-09/redux-architecture.jpg)](https://krasimir.gitbooks.io/react-in-patterns/content/chapter-09/#redux-architecture-and-its-main-characteristics)
![Redux Store](https://css-tricks.com/wp-content/uploads/2016/03/redux-article-3-02.svg)
![Error Prone and Confusing Strategies vs Redux](https://css-tricks.com/wp-content/uploads/2016/03/redux-article-3-03.svg)
```javascript
import { useSelector } from "react-redux";
const var = useSelector(function(state){
return state.var;
});
```
> **Actions** are a plain JavaScript object that contains information.
```javascript
const action = {
type: MOUSE_EVENT,
x: 123,
y: 456,
button: MIDDLE_BUTTON,
state: RELEASED
};
```
## Torch Actions
* `BUTTON_PRESSED`
* `IMAGE_PRESSED`
* `STATE_CHANGED`
```javascript
import { useDispatch } from "react-redux";
const dispatch = useDispatch();
dispatch({
type: ACTION_TYPE,
value: 'Value'
});
```