azmenak / react-stripe-checkout

Load stripe's checkout.js as a react component. Easiest way to use checkout with React.
MIT License
985 stars 160 forks source link

Compiling issue? `Module build failed: SyntaxError: Unexpected token (6:12)` on example code #130

Closed sergioh213 closed 5 years ago

sergioh213 commented 5 years ago

I copy paste your example component TakeMoney, but I never get anywhere because in the onToken function declaration the compiler gives me an error. I tried updating babel, rebuilding the method myself, and more, but I can't seem figure it out.

I have the feeling this is very simple. I paste my compiling error below, as seen in the terminal:

`ERROR in ./src/TakeMoney.js Module build failed: SyntaxError: Unexpected token (6:12)

4 | export default class TakeMoney extends React.Component { 5 |

6 | onToken = (token) => { | ^ 7 | fetch('/save-stripe-token', { 8 | method: 'POST', 9 | body: JSON.stringify(token),`

(The arrow is supposed to point at the equal sign)

screen shot 2019-01-17 at 01 33 07