Next.js Discord

Discord Forum

Getting thrown error about failed fetch.

Answered
American Chinchilla posted this in #help-forum
Open in Discord
Original message was deleted.

8 Replies

Avatar
American Chinchilla
and here is the file that im calling textConversion in to display it:
import React, { useEffect, useState } from "react";
import { textConversion } from "./api/test/textConversion/route";


function Reader() {
  const [htmlContent, setHtmlContent] = useState('');

  useEffect(() => {
    textConversion().then((html) => {
      setHtmlContent(html);
    });
  }, []);

  return(
    <div>
      <div dangerouslySetInnerHTML={{ __html: htmlContent }} />
    </div>
  )
}

export default Reader;
I feel like the issue is when i'm calling the other file, so i'm going to provide myu file structure just incase it might be that
Image
dont fetch your own api's
Answer
Avatar
American Chinchilla
thanks i'll check that out
Avatar
American Chinchilla
I've been looking at this, but would it work because i'm using pandoc and fs which would need server-side functionality