nhn / toast-ui.react-calendar

TOAST UI Calendar wrapper for React.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how can i re-render calendar from state

alpha1226 opened this issue · comments

Version

^1.0.5

Test Environment

widnows10 pro 64bit

Current Behavior

i want to update schedule use state. but its not render new schedule
if call render, can not render new schedule

_insertSchedule = (title:string, body:string, start: Date, end: Date) => {
    const previousSchedule:ISchedule[] = this.state.schedule
    start = new Date(new Date(start.getFullYear(), start.getMonth(), start.getDate()).setHours(12,0,0))
    end = new Date(new Date(end.getFullYear(), end.getMonth(), end.getDate()).setHours(12,0,0))
    let newSchedule:ISchedule = {
      calendarId: "1",
      category: "time",
      title: title,
      id: (this.state.schedule.length+1).toString(),
      body: body,
      start: start,
      end: end
    }
    previousSchedule.push(newSchedule)
    this.setState({schedule: previousSchedule})
  }

Expected Behavior

how can render new schedule from state