React component with prop that takes a function typing help

Hey guys,

We have context in our app that holds callbacks that deeply nested forms can update their callbacks, but these need to be triggered by much higher parents of those forms. In the past we have stored these callbacks in context so that we can update them in the form and trigger that callback elsewhere.

Here is a little playground to help understand what we are trying to achieve with the type errors that we are experiencing.

https://rescript-lang.org/try?code=LYewJgrgNgpgBAMRAJ2HAvHA3gKDnAAWRgEMBjAFwDoyRgAHEGAOwrzlgrmBIGt5MACgB+ASzAAuOAGcKyUcwDmAGjjDpMCgGESUKACNyvAJQYAfNnb4ASqUpUIGgKIAzFzEqDBp9Bdz4Ajk1uAE8ECGYyDDhvc0tAwIApaSooEEVBACIACRg9EDgXZDpQ8MjM4ysAgF8cKvwNbV0DI0FgMIiySsDqyqqAHjBRADc-cQBaM1tyall5JWq4foB6IdH2WtqcUEhYOC0QVhYuTH9CYhmaOkZmY-ZObj4BGJ8-KofBYgBHCBhZABUQPxmKpGrYfn8KIDgT44NN7I4YABlCgkCgwQQAfTiADlDjA+oEHhB6GA0TBwb8AUCWNEyPo4mdAmCYBDqcCsXF6ZMkXQCVUtkTgt8qScXoz6jIAO6iChkAAWcBFkOhtKZAQAPnBecAMfTXnB6d5JVq8bc4slUuksnj9s1DGReDJNCSKpLaj06oFBiMzJL+khUHBxOhMgBGTLOpp6B28dBYelxElk9GUlU05iCfWLZZ+hJLfQQCgUQ5wQ5aKCiR3x7G+JWs0Xeap+TJIiD6YCyzKTeGzOQKRSLFaF4uHPMBFZrcebHBAA

@dan003400 Typo on line 2 compoent. If it’s fixed there aren’t any errors :-/

Update: Also you need to return an option from useEffect in this case None

Update2: https://rescript-lang.org/try?code=LYewJgrgNgpgBAMRAJ2HAvHA3gKDnAAWRgEMBjAFwDoyRgAHEAOxiYrzlgrmBIGt4mABQA-AJZgAXHADOFZGKYBzADRwRMmBQDCJKFABG5PgEoMAPmwd8AJVKUqETQFEAZq5iUhQs+ku58QM4tHgBPBAgmMgw4HwsrIKCAKRkqKBAlIQAiAAkYfRA4V2Q6MIiorJNrQIBfHGr8TR09Q2MhYHDIsirEgDlmGGqaquqAHjAxADd-CQBacztyajkFZRq4UYB6CemOOrqcUEhYOG1mClZuTADCYiWaOkYWNg4uHn5BWN9-arehYgAjhAYHIACogARMNRNOxAkEUcGQ3xwRYOJwwADKFBIFyEAH14v0WCMgm8IPQwDiYLDgWCIawYmQDPEbkEYTA4XTIfj4kz5hi6DAerV6qSQoDaVcviyGrIAO5iChkAAWcAl8MRDNZgQAPnABcAYEImd84EyfLK9UTBJYUmkMtl+qcWkYyHxZFpyZVZXUggcguMpuZZaMkKg4BJ0FkAIxZD3NfSuvjoLBM+LkykXGka+lMY0GEzrTbBxIbAwQCgUZhwZjaKBiN0pgl+NUcyU+Gr+LIYiAGYCKrLzVHLeSKJTrLblyvMEuBLY7Wf7HBAA

1 Like

Thanks so much @alexeygolev - It also took us a minute to realize that spelling typo as the error message was very odd and something we have never seen before haha.

Thanks so much for your help!

1 Like