@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>
	);
};

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

    Package Sidebar

    Install

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

    Weekly Downloads

    12

    Version

    0.1.5

    License

    none

    Unpacked Size

    2.11 kB

    Total Files

    3

    Last publish

    Collaborators

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