Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to console.log props in React?

Tags:

reactjs

I'm new to React and have been thrown in the deep end with a task.

I must adjust the data for a date props. This looks (as far as I can tell) like:

form.defaultProps = {
  conf: {},
  minDate: new Date(),
  maxDate: new Date(new Date().setFullYear(new Date().getFullYear() + 2)),
};

I want to test if maxDate is the prop I am after. To do that I want to console.log (or equivalent) its output.

Would anyone know how I should be doing this?

like image 862
MeltingDog Avatar asked Mar 06 '23 07:03

MeltingDog


1 Answers

You should be able to just log it directly:

console.log(form.defaultProps);

Most likely, you might want to this within the form component you are creating by calling console.log(this.props).

like image 95
janhartmann Avatar answered Apr 21 '23 12:04

janhartmann