Handle null children exception
See original GitHub issueThanks for taking the time to file an issue with us. Please note that this issue template is used ONLY for reporting bugs.
If you have an issue that isn’t a bug, please follow the steps listed in the Contributing. Thanks!
Expected behavior
If you pass as a child a React Component which could be null, this causes an unexpected TypeError.
Current behavior
Observer is passed the null instance and a TypeError occurs
Steps to reproduce
- Create an IntersectionObserver as a HOC and pass in a React Component (Class or SFC, returning
null) as the only child - Observe that the observer attempts to attach to whatever the React Component returns;

Context (environment)
This got past our CI pipeline because TypeScript (correctly) allows null as a valid return type from React.SFC or React.ReactNode. I will try to take a look and provide my own solution, but please also advise if this is due to a limitation within React or otherwise.
- Version: “0.7.3”
- Platform: OSX Debian
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to handle null child Entities in MVC Razor - Stack Overflow
I have an MVC razor view that iterates over an Orders collection. Each order has a Customer, which can be null. Trouble is,...
Read more >Handle NULL child elements in XML node - MSDN - Microsoft
I can see that the first grand child element is NULL. It throws 'object reference is not set to an instance of object'...
Read more >Handling Nulls in nested objects (Java) - Lalit Vatsal - Medium
Handling NullPointerException and keeping track of all the nullable values has always been a pain for Java developers.
Read more >attempt to de-reference null object when using maps to build ...
Is there a simple way to handle this null error when manually building this parent-child map? I expect that I will have many...
Read more >Coroutine exceptions handling | Kotlin Documentation
Here we look at what happens if an exception is thrown during cancellation or multiple children of the same coroutine throw an exception....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@311289189 see #52
I will give it a shot in the next few days