All files / src/components/Stack Stack.jsx

76.31% Statements 29/38
66.66% Branches 2/3
50% Functions 1/2
76.31% Lines 29/38

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 391x 1x 1x 1x 1x 1x 7x 7x 7x                   7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 1x 1x  
import React, { useEffect } from "react";
import { DataState } from "./../../context/DataContext";
import "./Stack.css";
import axios from "axios";
 
const Stack = () => {
  const { refresh, stack, setStack } = DataState();
 
  const fetchStackData = async () => {
    try {
      const data = await axios.post("http://127.0.0.1:10000/stack_trace", {
        name: "program",
      });
      setStack(data.data.result);
    } catch (error) {
      console.error("Error fetching stack:", error);
    }
  };
 
  useEffect(() => {
    if (refresh) fetchStackData();
  }, [refresh]);
 
  return (
    <div className="stack-parent">
      <div className="stack-heading">Stack</div>
      <div className="stack">
        <div>{stack}</div>
        <div>0x001780c8 0x001780c8 0x001780c8 0x001780c8</div>
        <div>0x001780c8 0x001780c8 0x001780c8 0x001780c8</div>
        <div>0x001780c8 0x001780c8 0x001780c8 0x001780c8</div>
        <div>0x001780c8 0x001780c8 0x001780c8 0x001780c8</div>
      </div>
    </div>
  );
};
 
export default Stack;