Skip to content

Autosave indicator #891

Answered by radekmie
bmartin1134 asked this question in Q&A
Mar 4, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi @bmartin1134 and thanks for the suggestion. While I don't think there's a need for it in the core themes (what loader to show, maybe you'd need text there, whether it's at the top or the bottom, is the form disabled while it's saving, etc.), I agree that it may be a good example in our docs.

Here's a quick example of how it can be used:

import React from 'react';
import { useForm } from 'uniforms';

enum FormState {
  Error,
  Idle,
  Submitting,
  Validating,
}

function useFormState() {
  const uniforms = useForm();
  return uniforms.error
    ? FormState.Error
    : uniforms.submitting
    ? FormState.Submitting
    : uniforms.validating
    ? FormState.Validating
    : FormState.Idle;

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bmartin1134
Comment options

Answer selected by radekmie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants