-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
I've tried to use the component and had no errors but it didn't work. Are you guys still maintaining this or I'm missing something?
Here's my component code:
import React, { useState, useEffect, Suspense } from 'react';
import EmbedContainer from 'react-oembed-container';
import axios from '../../../../node_modules/axios/dist/axios.js';
const RealTime = () => {
const [content, setContent] = useState('');
useEffect(() => {
const options = {
url: wpApiSettings.root + 'wp/v2/custom-post-type/' + postTypeID,
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json;charset=UTF-8'
},
};
function requestPosts(options) {
axios(options).then( response => {
console.log( response );
setContent( response.data.content.rendered );
});
setTimeout(requestMoments, 20000, options);
};
requestPosts(options);
});
return (
<EmbedContainer markup={content}>
<div dangerouslySetInnerHTML={{ __html: content }}></div>
</EmbedContainer>
)
}
export default RealTime;Thanks in advance!
Metadata
Metadata
Assignees
Labels
No labels