react-query-firebase icon indicating copy to clipboard operation
react-query-firebase copied to clipboard

Dependency issue

Open vishnu-vk opened this issue 3 years ago • 1 comments

const Register = () => {


  const {data} = useAuthUser(["user"], auth)

  const ref = doc(usersDb, data.uid)
  const addOtherFields = useFirestoreDocumentMutation(ref)
  
  const newUser = useAuthCreateUserWithEmailAndPassword(auth, {
    onSuccess(){
      addOtherFields.mutate({name: "jhon Smith", age:20})
    }
  })
  

  const submit = () => {
    newUser.mutate({ email: "[email protected]", password: "123456" });
  };


  return (
    <div>
      <button onClick={submit}>register</button>
    </div>
  );
};

export default Register;

how can I use the uid of the user in the doc reference path. I am trying to add additional data about the user in a users collection.

vishnu-vk avatar Nov 30 '22 14:11 vishnu-vk

You can use the enabled option as mentioned here : https://github.com/invertase/react-query-firebase/issues/18

fhuel avatar Feb 17 '23 21:02 fhuel