import React, {Component} from "react"; import {Tip} from "./Tip"; class Line extends Component { constructor(props) { super(props); // Initialize the state object with the initial values from the props this.state = { text: props.outvar in props.data ? props.data[props.outvar] : (props.fallback ? props.fallback : "") }; // Bind the event handler to this this.handleClick = this.handleClick.bind(this); this.props.target.construct(this.props.outvar, this.state.text); } handleClick(element) { let text = element.target.value; this.setState({ text: text }); this.props.target.update(this.props.outvar, text); } static getDerivedStateFromProps(props, current_state) { if (current_state.text !== props.data[props.outvar]) { return { text: props.data[props.outvar] } } return null } render() { let key = this.props.id + this.props.outvar; return (
{this.props.tip && }
); } } export function LineWrapper(target, id, data, {title, fallback, outvar, icon, tip}) { return ; }