Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
why do I not get the data fonr console.log: daysNB

I don't know why console.log daysNB2 and console.log daysNB3 gets the data (15:27) (see screenshot) but daysNB does not? I should get the data as a prop (days) but it just works with useEffect but not with setting the initial state in useState as in the code

please have a look at the code:

export default function WeekdayPickerNotification(props) {
  let {days, onChange} = props;

  const [isTimePickerVisible, setIsTimePickerVisible] = useState(false);
  const [selectedDate, setSelectedDate] = useState('');

  console.log("daysNB: ", days);

  const [dz, setDz] = useState([{id: 1, selected: false, time: days[0], day: 'Mo'},
    {id: 2, selected: false, time: days[1], day: 'Di'},
    {id: 3, selected: false, time: days[2], day: 'Mi'},
    {id: 4, selected: false, time: days[3], day: 'Do'},
    {id: 5, selected: false, time: days[4], day: 'Fr'},
    {id: 6, selected: false, time: days[5], day: 'Sa'},
    {id: 7, selected: false, time: days[6], day: 'So'}]);

  useEffect(() => {
    console.log("daysNB2: ", days);
  }, [])

  useEffect(() => {
    console.log("daysNB3: ", days);
    onChange(dz);
  }, [dz])

I get following console.log outputs:

  • LOG daysNB2: {"0": "", "1": "", "2": "", "3": "", "4": "", "5": "", "6": "15:27"}
  • LOG daysNB3: {"0": "", "1": "", "2": "", "3": "", "4": "", "5": "", "6": "15:27"}
  • LOG daysNB: {"0": "", "1": "", "2": "", "3": "", "4": "", "5": "", "6": ""}
  • LOG neyz noti_3: {"0": "", "1": "", "2": "", "3": "", "4": "", "5": "", "6": ""}

thanks for your help.

console log for the print

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!