2

How can I refactor this react node to TS: {({ value }) => this.props.children(value)} `?

It says no constituent of react node is callable.

Here is the full function:

render() {
    return (
      <Animate
        start={() => ({
          value: this.props.valueStart,
        })}
        update={() => ({
          value: [
            this.state.isAnimated ? this.props.valueEnd : this.props.valueStart,
          ],
          timing: {
            duration: this.props.duration * 1000,
            ease: this.props.easingFunction,
          },
        })}
      >
        {({ value }) => this.props.children(value)}
      </Animate>
    );
  }

I have checked this question but it did not help me, probably because I am using typescript:

How to pass props to {this.props.children}

moon reborn
  • 91
  • 1
  • 4

0 Answers0