Created
October 15, 2023 02:26
-
-
Save ryochin/b15deec1caabe14e5f978f2bde792cc0 to your computer and use it in GitHub Desktop.
Rails: CSRF token on React
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { csrfToken } from '@rails/ujs' | |
export const AuthenticityToken = (): React.ReactElement => | |
<input type="hidden" name="authenticity_token" value={csrfToken() ?? ''} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment