Skip to content

Instantly share code, notes, and snippets.

View salmanamemon's full-sized avatar
💭
Can do it!

Salman Aziz salmanamemon

💭
Can do it!
View GitHub Profile
@salmanamemon
salmanamemon / wp-contact-form-7.tsx
Created October 24, 2021 09:24 — forked from blivesta/wp-contact-form-7.tsx
Use contact-form-7 API with React
import * as React from 'react';
import * as Yup from 'yup';
import axios from 'axios';
import { Formik } from 'formik';
const URL = process.env.WP_REST_API_BASE_URL;
const USER = process.env.WP_USER;
const PASSWORD = process.env.WP_APPLICATION_PASSWORD;
const TOKEN = typeof window !== 'undefined' && window.btoa(`${USER}:${PASSWORD}`); // Convert Base64
const CF7_ID = process.env.WP_CF7_ID;