|
constructor(props){ |
|
super(props); |
|
this.state = { |
|
variable: props.variable, |
|
content: props.content, |
|
n_rows: props.n_rows, |
|
n_total_lines: props.n_total_lines |
|
} |
|
} |
|
|
|
componentWillReceiveProps(nextProps){ |
|
this.setState({ |
|
variable: nextProps.variable||this.state.variable, |
|
content: nextProps.content||this.state.content, |
|
n_rows: nextProps.n_rows||this.state.n_rows, |
|
n_total_lines: nextProps.n_total_lines||this.state.n_total_lines |
|
}) |
|
} |
Hi, i'm one of the developers from Birdie. I just want to ask a few questions concerning your code as I review it.
What is your reasoning for mapping the props to the component state?