22 lines
529 B
React
22 lines
529 B
React
import {useEffect} from 'react'
|
|
import {addTodo} from '../store/todosReducer'
|
|
import {useSelector, useDispatch} from 'react-redux'
|
|
function Hehe(){
|
|
const test1=()=>{
|
|
dispatch(addTodo('love'))
|
|
}
|
|
const {todos}=useSelector(state=>state.todos)
|
|
const dispatch=useDispatch()
|
|
useEffect(()=>{
|
|
test1()
|
|
},[])
|
|
console.log(todos)
|
|
return (
|
|
<div>
|
|
<h1>page1</h1>
|
|
<button onClick={test1}>TodosReducer</button>
|
|
|
|
</div>
|
|
)
|
|
}
|
|
export default Hehe |