function validate(values) {
    // console.log(values) -> { title:'asas', categories:'asda', content: 'sada' } 
    const errors = {}

    // validate the inputs from values
    if(!values.title || values.title.length < 3) {
        errors.title = "Enter a title that is at least 3 characters"
    }

    if(!values.categories) {
        errors.categories = "Enter some categories"
    }

    if(!values.content) {
        errors.content = 'Enter some content please'
    }

    // if errors is empty the form is fine to submit
    // if errors has any properties, redux assumes the form
    // sis invalid
    return errors
}
// when user attempts to submit the form
when user attempts to submit the form
when user attempts to submit the form
function validate(values) {
    const errors = {}
    if(!values.title || values.title.length < 3) {
        errors.title = "Enter a title that is at least 3 characters"
    }
    if(!values.categories) {
        errors.categories = "Enter some categories"
    }
    if(!values.content) {
        errors.content = 'Enter some content please'
    }
    return errors
}
function validate ( values ) { const errors = { } if ( ! values . title || values . title . length < 3 ) { errors . title = "Enter a title that is at least 3 characters" } if ( ! values . categories ) { errors . categories = "Enter some categories" } if ( ! values . content ) { errors . content = 'Enter some content please' } return errors }
when user attempts to submit the form
when user attempts to submit the form
// console.log(values) -> { title:'asas', categories:'asda', content: 'sada' }  // validate the inputs from values // if errors is empty the form is fine to submit // if errors has any properties, redux assumes the form // sis invalid