How to use the recoil.useRecoilValue function in recoil

To help you get started, we’ve selected a few recoil examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github c-bata / goptuna / dashboard / src / components / StudyList.tsx View on Github external
export const StudyList: FC<{}> = () => {
  const classes = useStyles()
  const [openNewStudyDialog, setOpenNewStudyDialog] = React.useState(false)
  const [openDeleteStudyDialog, setOpenDeleteStudyDialog] = React.useState(
    false
  )
  const [deleteStudyID, setDeleteStudyID] = React.useState(-1)
  const [newStudyName, setNewStudyName] = React.useState("")
  const [maximize, setMaximize] = React.useState(false)

  const action = actionCreator()
  const studies = useRecoilValue(studySummariesState)

  const newStudyNameAlreadyUsed = studies.some(
    (v) => v.study_name === newStudyName
  )

  useEffect(() => {
    action.updateStudySummaries()
  }, [])

  const columns: DataGridColumn[] = [
    {
      field: "study_id",
      label: "Study ID",
      sortable: true,
    },
    {
github c-bata / goptuna / dashboard / src / components / StudyDetail.tsx View on Github external
export const useStudyDetailValue = (studyId: number): StudyDetail | null => {
  const studyDetails = useRecoilValue(studyDetailsState)
  return studyDetails[studyId] || null
}

recoil

Recoil - A state management library for React

MIT
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis