Skip to content

React or NextJS implementation #63

Pinned Answered by mettamyron
mettamyron asked this question in Q&A
Discussion options

You must be logged in to vote

I finally got this working, so just putting the answer here.
I had to make the env variable public for NextJS (NEXT_PUBLIC) and target the data node. Otherwise straightforward.

import { useState, useEffect } from 'react';
import React from 'react';
import BMC from 'buymeacoffee.js';

const access = process.env.NEXT_PUBLIC_BMC;
const coffee = new BMC(access);

export function BMCSupporters() {
    const [data, setData] = useState([]);

    useEffect(() => {
        coffee.Supporters()
        .then(data => setData(data.data))     
    }, [])
    return (
        <div className='about'>
            {!data ? ('Loading...') : (
                <ul>
                    {data.map((item) => (
  …

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@warengonzaga
Comment options

@mettamyron
Comment options

Comment options

You must be logged in to vote
1 reply
@warengonzaga
Comment options

Answer selected by warengonzaga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants