Skip to content

Instantly share code, notes, and snippets.

@Chojiu15
Created April 26, 2021 13:46
Show Gist options
  • Save Chojiu15/6e41a976c092955c46823d288cb234ca to your computer and use it in GitHub Desktop.
Save Chojiu15/6e41a976c092955c46823d288cb234ca to your computer and use it in GitHub Desktop.
client
import React, {useState, useEffect} from "react";
import "./App.css";
import {client} from './client'
import axios from 'axios'
const App = () => {
const [articles, setArticles] = useState([])
useEffect(() => {
client.getEntries({
content_type : 'weeklyProject'
})
.then(response => console.log(response.items))
})
return (
<div className="App">
</div>
);
};
export default App;
import * as contentful from 'contentful'
require('dotenv').config()
export const client = contentful.createClient({
space : process.env.SPACE_KEY,
accessToken : process.env.ACCESS_TOKEN
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment