How to use the redux-react-hook.useMappedState function in redux-react-hook

To help you get started, we’ve selected a few redux-react-hook 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 jauhararifin / ugrade / desktop / src / contest / problem / useProblemList.ts View on Github external
export function useProblemList() {
  useProblems()
  return useMappedState(getProblemList)
}
github jauhararifin / ugrade / desktop / src / contest / submission / useSubmissionList.ts View on Github external
export function useSubmissionList() {
  useSubmissions()
  return useMappedState(getSubmissionList)
}
github jauhararifin / ugrade / web / src / contest / announcement / useAnnouncements.ts View on Github external
export function useAnnouncements() {
  const dispatch = useAppThunkDispatch()

  useSingleEffect(
    'USE_ANNOUNCEMENTS',
    () => {
      const subs = dispatch(subscribeAnnouncementsAction())
      return () => {
        subs.then(unsub => unsub()).catch(globalErrorCatcher)
      }
    },
    []
  )

  return useMappedState((state: AppState) => state.contest.announcements)
}
github rvpanoz / luna / app / containers / Audit.js View on Github external
const Audit = ({ classes }) => {
  const { loading, message, mode, result } = useMappedState(mapState);
  const [metadataValues, setMetadata] = useState({
    dependencies: 0,
    devDependencies: 0,
    optionalDependencies: 0,
    vulnerabilities: null,
    advisories: null
  });
  const dispatch = useDispatch();
  const { content, error } = result || {};

  const auditRun = option =>
    dispatch(
      runAudit({
        ipcEvent: 'npm-audit',
        cmd: ['audit'],
        options: {
github mmazzarolo / just-tap / src / containers / Menu.tsx View on Github external
export const Menu: FunctionComponent = memo(() => {
  console.warn(" - ");
  const { highScore } = useMappedState(mapState);
  const { navigateToPlayground } = useMappedActions(mapActions);
  const [animationStatus, setAnimationStatus] = useState<"showing" | "hiding">(
    "showing"
  );

  const handlePress = async () => {
    setAnimationStatus("hiding");
    await delay(MENU_ANIM_DURATION);
    navigateToPlayground();
  };

  return (
github rvpanoz / luna / app / components / pages / __Dashboard / Dashboard.js View on Github external
const Dashboard = props => {
  const { classes } = props;

  const {
    packages,
    packagesOutdated,
    loading,
    directory,
    mode,
    projectName,
    projectVersion,
    projectDescription,
    projectLicense,
    lastUpdatedAt
  } = useMappedState(mapState);

  const title =
    mode === APP_MODES.LOCAL ? `Project ${projectName || ''}` : 'Global';
  const text =
    mode === APP_MODES.LOCAL ? projectDescription : APP_INFO.GLOBAL_MESSAGE;

  return (
    <section>
      
        
          </section>
github jauhararifin / ugrade / desktop / src / scenes / Dashboard / TopNavigationBar / TopNavigationBar.tsx View on Github external
export const TopNavigationBar: FunctionComponent = () => {
  useContestOnly()
  const user = useMe()
  const breadcrumbs = useMappedState(selectBreadcrumb)
  const push = usePush()
  const signOut = useSignOut()

  const breadcrumbWithRouter = breadcrumbs.map(breadcrumbItem => ({
    ...breadcrumbItem,
    onClick: () => {
      if (breadcrumbItem.href) push(breadcrumbItem.href)
    },
    href: undefined,
  }))

  const handleSignOut = async () => {
    await signOut()
    TopToaster.showSuccessToast('Signed Out')
  }
  const handleMyAccount = () => push('/account')
github jauhararifin / ugrade / frontend / src / server / useServerClock.ts View on Github external
export function useServerClock(refreshRate: number = 1000) {
  const clockStat = useMappedState(getClock)

  function calculateNow() {
    if (clockStat.clock) {
      const now = Date.now()
      const localClock = clockStat.localClock.getTime()
      const serverClock = clockStat.clock.getTime()
      return new Date(now + serverClock - localClock)
    }
    return undefined
  }

  useLoadServerClock()
  const [clock, setClock] = useState(calculateNow())
  const [current, setCurrent] = useState(new Date())

  useEffect(() => {
github jauhararifin / ugrade / frontend / src / settings / useProxySetting.ts View on Github external
export function useProxySetting(): [
  ProxySetting,
  (
    host: string,
    port: string | number,
    username?: string,
    password?: string
  ) => any
] {
  const proxySetting = useMappedState(getProxySetting)
  const dispatch = useAppDispatch()
  const setFunction = (
    host: string,
    port: string | number,
    username?: string,
    password?: string
  ) => {
    dispatch(setProxy(host, port, username, password))
  }
  return [proxySetting, setFunction]
}
github rvpanoz / luna / app / containers / AppTopBar.js View on Github external
const AppTopBar = ({ classes, className }) => {
  const {
    metricsRegistry,
    auditLevel,
    cache,
    mode,
    directory,
    notifications,
    loading,
    activePage
  } = useMappedState(mapState);

  const [initFlow, toggleInitFlow] = useState({
    show: false,
    directory: null
  })
  const [dialog, setDialog] = useState({
    open: false,
    title: '',
    active: null
  });

  const dispatch = useDispatch();

  const onLoadDirectory = useCallback(() => {
    const dialogHandler = filePath => {
      dispatch(

redux-react-hook

React hook for accessing a Redux store.

MIT
Latest version published 4 years ago

Package Health Score

59 / 100
Full package analysis