Discourse implementation in create react app

I am a new user to Discourse. I am trying to implement Discourse commenting into my React app but looks very complex to me. Is there a simple public API call that I can make with axios of fetch? I want to start with this because I tried with my API keys and username but there is axios error:

    const fetchComments = async () => {
      try {
        const response = await axios(
          'https://discourse.mydomain.com/t/category/13.json',{
            headers: {
              'Api-Key': apiKey,
              'Api-Username': apiUsername
            }
          }
        )
.then(data=>datas.json())
.then(checkData=>console.log(checkData)
        console.log("discourse",response)
      } catch (error) {
        console.error('Error fetching comments:', error);
      }
    };```

Maybe you want Embed Discourse comments on another website via Javascript?

2 Likes

This is a React Native app that uses the Discourse API, might be of some help?

2 Likes