Skip to content
Discussion options

You must be logged in to vote

https://codesandbox.io/s/adoring-forest-5lbmr?file=/src/App.js

import { CountryDropdown } from "react-country-region-selector";
import { useForm, Controller } from "react-hook-form";

import "./styles.css";

export default function App() {
  const { control, handleSubmit } = useForm({
    defaultValues: {
      test: ""
    }
  });

  return (
    <form
      onSubmit={handleSubmit((data) => {
        console.log(data);
      })}
    >
      <Controller
        name="test"
        render={({ field: { name, onChange, value } }) => (
          <CountryDropdown
            defaultOptionLabel="Select Country"
            name={name}
            value={value}
            onChange={onChange}

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
8 replies
@freedomfflow
Comment options

@freedomfflow
Comment options

@freedomfflow
Comment options

@bluebill1049
Comment options

@bluebill1049
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by bluebill1049
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