Skip to content

Commit

Permalink
HistographicDataUpdationProblemSolved
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth352 committed Dec 28, 2021
1 parent f318111 commit f372a40
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/CoinInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const CoinInfo = ({ coin }) => {
const [historicData, setHistoricData] = useState();
const [days, setDays] = useState(1);
const { currency } = CryptoState();
const [flag,setflag] = useState(false);

const useStyles = makeStyles((theme) => ({
container: {
Expand All @@ -39,7 +40,7 @@ const CoinInfo = ({ coin }) => {

const fetchHistoricData = async () => {
const { data } = await axios.get(HistoricalChart(coin.id, days, currency));

setflag(true);
setHistoricData(data.prices);
};

Expand All @@ -62,7 +63,7 @@ const CoinInfo = ({ coin }) => {
return (
<ThemeProvider theme={darkTheme}>
<div className={classes.container}>
{!historicData ? (
{!historicData | flag===false ? (
<CircularProgress
style={{ color: "gold" }}
size={250}
Expand Down Expand Up @@ -108,7 +109,9 @@ const CoinInfo = ({ coin }) => {
{chartDays.map((day) => (
<SelectButton
key={day.value}
onClick={() => setDays(day.value)}
onClick={() => {setDays(day.value);
setflag(false);
}}
selected={day.value === days}
>
{day.label}
Expand Down

6 comments on commit f372a40

@coderfrnd
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. my chart.js
    Screenshot (80)
    see this is my error
    what should i do ?

@amansadhwani
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"react-chartjs-2": "^3.0.4", try downgrading this package ,worked for m

@Ishazaka
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.0.4

can you plz tell me, how ... mine is still n0t working i tried different versions
first i installed latest version of react-chartjs-2 then i uninstall it ..
now i am trying another version( npm i react-chartjs-2@3.0.4 chart.js@^3.0.0),, my terminal show me this error....

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || ^17.0.0" from react-chartjs-2@3.0.4
npm ERR! node_modules/react-chartjs-2
npm ERR! react-chartjs-2@"3.0.4" from the root project

@amansadhwani
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iangeron
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this on your code, worked in mine after i downgraded to react chart js 3.0.4

  1. add use params and import it too
    const { id } = useParams();

  2. change the axios get line from coin.id to id

  3. onst { data } = await axios.get(HistoricalChart(id, days, currency));

@SaraswathiSP
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting this error what to do tried many ways and nothing is displaying except a white blank page.
Screenshot 2023-04-13 203236

Please sign in to comment.