Can not pass content into NewsTicker
Closed this issue · 0 comments
ShenShu2016 commented
Hello ahemetcanaydemir,
I very like this project. I am new to react. But when I want to pass content in to NewTicker it did show anything.
import React, { useRef, useState, useEffect } from "react";
import NewsTicker, { Directions } from "../react-advanced-news-ticker/index";
import "./HomeTickers.css";
function HomeTickers() {
const ref1 = useRef(null);
const ref2 = useRef(null);
const [newsData, setNewsData] = useState({});
useEffect(() => {
getNewsWithFetch();
}, []);
const getNewsWithFetch = async () => {
const response = await fetch("http://127.0.0.1:8000/news/article_list/");
const jsonData = await response.json();
setNewsData(jsonData[0]);
};
return (
<div>{newsData.content}</div>
);
}
Thank you