Comments (14)
Try it multiple times don't give up it will work
code didn't help then you should check
savePaymentMethod did work properly
from amazona.
check sumbithandler.
from amazona.
from amazona.
where did you have put that
on form or button
if you have put it in
form then use onSubmit event
for button use onClick event
from amazona.
mohitshahu,
I appreciate your reply. I believe on form but I am not sure. Please take a look at my code if you can and thank you very much for your help.
import React, { useState } from 'react'
import { useDispatch, useSelector } from 'react-redux';
import { savePaymentMethod } from '../actions/cartActions';
import CheckoutSteps from '../components/CheckoutSteps';
export default function PaymentMethodScreen(props) {
const cart = useSelector((state) => state.cart);
const { shippingAddress } = cart;
if (!shippingAddress.address) {
props.history.push('/shipping');
}
const [paymentMethod, setPaymentMethod] = useState('PayPal');
const dispatch = useDispatch();
const submitHandler = (e) => {
e.preventDefault();
dispatch(savePaymentMethod(paymentMethod));
props.history.push('/placeorder');
};
from amazona.
Do I need to have history as a prop?
from amazona.
sorry for the late response buddy
Do I need to have history as a prop?
:: no not at history is property of props object.
we can assess it like props.history.
from amazona.
After going through your code I didn't find any issue.
After all, I am also a beginner π.
Here is my code, if it can help
import React, { useState } from "react";
import CheckoutSteps from "../CheckoutSteps/CheckoutSteps";
import { useDispatch, useSelector } from "react-redux";
import { savePaymentMethod } from "../../../redux/actions/cartActions";
export default function PaymentMethodScreen(props) {
const cart = useSelector((state) => state.cart);
const { shippingAddress } = cart;
if(!shippingAddress.address){
props.history.push('/shipping');
}
const [paymentMethod, setPaymentMethod] = useState("PayPal");
const dispatch = useDispatch();
const submintHandler = (e) => {
e.preventDefault();
dispatch(savePaymentMethod(paymentMethod));
props.history.push("/placeorder");
};
return (
Payment
<input
type="radio"
id="paypal"
value="PayPal"
name="paymentMethod"
required
checked
onChange={(e) => setPaymentMethod(e.target.value)}
/>
Paypal
<input
type="radio"
id="stripe"
value="Stripe"
name="paymentMethod"
required
onChange={(e) => setPaymentMethod(e.target.value)}
/>
Stripe
Continue
);
}
from amazona.
i have completed that application
deployed over heruko
https://tech360i.herokuapp.com/
from amazona.
Hllo mohitsahu I will also got error after deploying on heroku my products not showing after deploy on heroku in local host it will saw but when I connect with online MongoDB atlas it will not show please help me
from amazona.
i have completed that application
deployed over heruko
https://tech360i.herokuapp.com/
Hllo please help me when I deploy it to heroku and when I will connect with MongoDB atlas it will not insert my sample users and product into online MongoDB atlas database so i will copy paste products data manually it will show product but when I click on product It will show error product not found can you help me to solve this.
And when I register as newbuddy it insert data in online database and also signin works with that .
from amazona.
from amazona.
mohitshahu108, I apologize for the very late response. I also have since completed the project and I really appreciate your help. Great job with the website! Thank you
β¦
Sent from my iPhone
On May 23, 2021, at 3:13 AM, mohitshahu108 @.***> wrote: i have completed that application deployed over heruko https://tech360i.herokuapp.com/ β You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Hey DmoniqueMCasteneda ,please help me when I deploy it to heroku and when I will connect with MongoDB atlas it will not insert my sample users and product into online MongoDB atlas database so i will copy paste products data manually it will show product but when I click on product It will show error product not found can you help me to solve this.
And when I register as newbuddy it insert data in online database and also signin works with that .
from amazona.
from amazona.
Related Issues (20)
- Unhandled Rejection (TypeError): Cannot read property 'product' of null HOT 1
- MongoDB error Products.count() buttering timeout 10000ms
- Create SECURITY.md
- Google Map is not showing instead infinite Loading HOT 2
- ProductEditScreen isnt working HOT 4
- lesson 28
- Uncaught TypeError: cartItems.map is not a function HOT 1
- Can you provide the code to implement size of tshirts?
- Errortype: can not read property of undefined (reading substring)
- Errortype: can not read property of undefined (reading substring)
- Heroku Error HOT 1
- Signout error
- TypeError: Cannot read property 'image' of undefined HOT 1
- React application is not opening, it showing error
- Mern tutorial source code
- Mern tutorial source code
- I'm getting a : TypeError: Cannot read property 'category' of undefined
- Iam getting Order validation failed error in backend terminal when I click on place order button. can anyone help me to fix this issue with line of code as i
- Adding redux to Homescreen
- After deploy to heroku product not showing error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazona.