skip to Main Content

Reactjs – Node.js receive form data sent from frontend

node.js server app.post('/create-checkout-session', (req,res) =>{ console.log(req.form); console.log(req.body); const session = await stripe.checkout.sessions.create({ line_items: [ { price: "price_id", quantity: 1, }, ], metadata: { id: 1, email: "soubhagya", }, mode: "payment", success_url: `https://www.youtube.com/?success=true`, cancel_url: `https://www.youtube.com/?canceled=true`, }); res.redirect(303, session.url); }) React frontend…

VIEW QUESTION

Javascript – Filtering notices with redux-toolkit

This is my notesSlice: import { createSlice, createAsyncThunk } from "@reduxjs/toolkit"; import axios from "axios"; const url = "http://localhost:8000/"; const initialState = { notices: [], }; export const getNotices = createAsyncThunk( "notices/getNotices", async (_name, thunkAPI) => { try { const…

VIEW QUESTION

Reactjs – How do I pass a counter into a component's function?

Learning react here and doing the tic-tac-toe intro here: https://react.dev/learn/tutorial-tic-tac-toe. I'm trying to understand why my code isn't working. I'm on the https://react.dev/learn/tutorial-tic-tac-toe#completing-the-game portion, where you add components like: <Square value={squares[8]} onSquareClick={() => handleClick(8)} /> I'm trying to take a…

VIEW QUESTION

ReactJs double render

When I try to refresh page it prints "1" twice. But I'm not using any useState or variable update or state change I think. Can you tell me where I'm wrong? import "./styles.css"; import React, { useState, useEffect, useRef }…

VIEW QUESTION
Back To Top
Search