got the title error and can't fix it :(. I'm triying to get the data from a signup page, here is my javascript code:

```
const SignupComponent = () => {
const [values, setValues] = useState({
    name: 'ryan',
    email: 'ryan@gmail.com',
    password: 'rrrrrr',
    error: '',
    loading: false,
    message: '',
    showForm: true
});

const { name, email, password, error, loading, message, showForm } = values;

const handleSubmit = e => {
    e.preventDefault();
    // console.table({ name, email, password, error, loading, message, showForm });
    setValues({ ...values, loading: true, error: false });
    const user = { name, email, password };

    signup(user).then(data => {
        if(data.error) {
            setValues({ ...values, error: data.error, loading: false });
        } else {
            setValues ({ ...values, name: '', email: '', password: '', error: '', loading: false, message: data.message, showForm: false});
        }
    });
};

const handleChange = name => e => {
    setValues({ ...values, error: false, [name]: e.target.value })

```

, so when i try to register in the page, its says TypeError: can't access property "error", data is undefined.

```
              signup(user).then(data => {
> 25 |             if(data.error) {
     |               ^
  26 |                 setValues({ ...values, error: data.error, loading: false });
  27 |             } else {

```

Signup Function

```
export const signup = (user) => { 
    return 
    fetch(${API}/signup, { method: 'POST', 
   headers: { Accept: 'application/json', 
   'Content-Type': 'application/json' }, 
    body: JSON.stringify(user) }) 
   .then(response => { return response.json(); }) 
     .catch(err => console.log(err));

```

i'm kinda nooby in programming but i already look in the internet for a solution, nothing works u.U