github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/public/src/components/alerts/Alerts.tsx (about)

     1  import React from "react"
     2  import { useAppState } from "../../overmind"
     3  import Alert from "./Alert"
     4  
     5  
     6  /* This component displays all alerts found in state.alerts */
     7  const Alerts = (): JSX.Element => {
     8      const state = useAppState()
     9      /* Index is used to remove the alert from the state.alerts array */
    10      const alerts = state.alerts.map((alert) => {
    11          return <Alert alert={alert} key={alert.id} />
    12      })
    13  
    14      return <div>{alerts}</div>
    15  }
    16  
    17  export default Alerts