first paragraph
import React from "react"
import { connect } from "react-redux"
import { addToCart } from "../actions/cart-actions"
let AddTodo = ({ dispatch }) => {
let input = "";
return (
<div>
<form
onSubmit={e => {
e.preventDefault()
if (!input.value.trim()) {
return
}
dispatch(addToCart(input.value, 1, 250))
input.value = ""
}}
>
<input
ref={node => {
console.log(" value ==", node )
input = node
}}
/>
<button type="submit">
</button>
</form>
</div>
)
}
AddTodo = connect()(AddTodo)
export default AddTodo
second paragraph
import React from "react";
import { connect } from "react-redux"
import "./assets/styles/index.less";
import Landscape from "./assets/images/landscape.png";
import Logo from "./assets/images/logo.png";
import Resize from "PATH_SRC_UTILS/res";
import HttpUtil from "PATH_SRC_UTILS/httpUtil";
import Helper from "PATH_SRC_UTILS/helper";
import StorageApi from "PATH_SRC_UTILS/storageApi";
import FetchServer from "PATH_SRC_UTILS/fetchServer";
import { beginToLogin } from "../actions/login-actions"
class Login extends React.Component {
constructor() {
super();
this.state = {
current: 0
}
this.handleClickLi = this.handleClickLi.bind(this);//
}
handleClickLi = ({dispatch}) => {
console.log("dispatch = ", dispatch)
}
render() {
const _self = this;
return (
<div className={"login_div"}>
<div
className={"login_button"}
onClick={() => this.handleClickLi(dispatch(beginToLogin("Coffee 500gm", 1, 250)))}
>
</div>
</div>
)
}
}
export default connect()(Login);