npm

@ueaweb/laravel-react-csrf-input

0.1.5 • Public • Published

Laravel React CSRF Input Component

A React component for Laravel that accepts a CSRF token and adds a hidden input to your form containing it.

Install

npm i @ueaweb/laravel-react-csrf-input

Usage

In your

element .blade.php
<meta name="csrf-token" content="{{ csrf_token() }}">

In your JS

import React from "react";
import CSRFInput from "@ueaweb/laravel-react-csrf-input";

const Form = () => {
	const myToken = document.head.querySelector('meta[name="csrf-token"]').getAttribute('content');
	
	return (
		<form method="POST">
			<CSRFInput token={myToken}>
		</form>
	);
};

Readme

Keywords

none

Package Sidebar

Install

npm i @ueaweb/laravel-react-csrf-input

Weekly Downloads

20

Version

0.1.5

License

none

Unpacked Size

2.11 kB

Total Files

3

Last publish

Collaborators

  • jamieplattenuea
  • karnege133
  • chima28
  • jimlundblad
  • ollie_watkins
  • alistairquinn-uea