Skip to content

Instantly share code, notes, and snippets.

@alexmochu
Created June 30, 2020 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexmochu/c16adc68991a93cec8e30b208f075d1f to your computer and use it in GitHub Desktop.
Save alexmochu/c16adc68991a93cec8e30b208f075d1f to your computer and use it in GitHub Desktop.
Setup App.js
import React from 'react';
import { useSelector, useDispatch } from 'react-redux';
import logo from './logo.svg';
import increment, { incrementAsync, decrement } from './actions';
import Counter from './Counter';
import './App.css';
function App() {
const dispatch = useDispatch();
const counter = useSelector(state => state.count)
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<Counter
value={counter}
onIncrement={() => dispatch(increment())}
onDecrement={() => dispatch(decrement())}
onIncrementAsync={() => dispatch(incrementAsync())}
/>
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<div>
Learn
{" "}
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
React,
</a>
{" "}
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Redux,
</a>
{" "}
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
React Redux
</a>
{" "}
and
{" "}
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Redux Saga
</a>
</div>
</header>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment