-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hey, I am trying to use formalizer in a next.js application, and I keep getting the following error:
ReferenceError: window is not defined
Below is a quick/truncated replication of my actual form showing a single input:
Box,
FormControl,
FormLabel,
FormErrorMessage,
FormHelperText,
Input,
} from "@chakra-ui/react";
import { useFormalizer } from "formalizer"; // @link https://github.com/nosachamos/formalizer
import { schema } from "@/models/schema";
export const Form = () => {
if (!process.browser) return;
const { formRef, useInput, errors, isValid } = useFormalizer();
const label = "label";
return (
<Box as={"form"} ref={formRef}>
<FormControl as='fieldset' isDisabled={false} isInvalid={!isValid}>
<FormLabel htmlFor={label}>{label}</FormLabel>
<Input {...useInput(label, ["isRequired"])} />
<FormHelperText>We'll never share your email.</FormHelperText>
<FormErrorMessage>{errors[label]}</FormErrorMessage>
</FormControl>
</Box>
);
};
NOTE: I also tried to import it dynamically as shown here
Metadata
Metadata
Assignees
Labels
No labels