我遵循了基本的 React stripe 文档:\n https://stripe.com/docs/stripe-js/react
\n所以这是我有问题的代码:
\n索引.js
\nimport React from \'react\';\nimport ReactDOM from \'react-dom\';\nimport App from \'./App\';\nimport {Elements} from \'@stripe/react-stripe-js\';\nimport {loadStripe} from \'@stripe/stripe-js\';\n\n// Make sure to call `loadStripe` outside of a component\xe2\x80\x99s render to avoid\n// recreating the `Stripe` object on every render.\nconst stripePromise = loadStripe(\'process.env.REACT_APP_STRIPE_PUBLIC_KEY\');\n\nfunction Index() {\n/* const options = {\n // passing the client secret obtained from the server\n clientSecret: \'{{CLIENT_SECRET}}\',\n }; */\n return (\n <Elements stripe={stripePromise} /* options={options} */>\n <App/>\n \n </Elements>\n );\n};\nReactDOM.render(<Index />, document.getElementById(\'root\'));\n …Run Code Online (Sandbox Code Playgroud)