Home > front end >  How can I write this in function component in react native
How can I write this in function component in react native

Time:03-04

constructor(props) {
  super(props)
  this.state = {
    signedIn: false,
    name: "",
    photoUrl: ""
  }
}

CodePudding user response:

Use useState with default values.

import { useState } from "react";

const Component = (props) => {
  const [signedIn, setSignedIn] = useState(false);
  const [name, setName] = useState("");
  const [photoUrl, setPhotoUrl] = useState("");

  return <></>
}

export { Component };
  • Related