Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So React added isReactComponent to Component class but the author doesn't explain why they couldn't just check for render() method. It works in this React-like library:

https://github.com/wisercoder/uibuilder/blob/master/UIBuilde...




Someone else asked that same question on Reddit [0], and Dan pointed out the paragraph in the post that answers it :

> One other possible heuristic could be to check for presence of a render method on the prototype. However, at the time it wasn’t clear how the component API would evolve. Every check has a cost so we wouldn’t want to add more than one. This would also not work if render was defined as an instance method, such as with the class property syntax.

[0] https://www.reddit.com/r/reactjs/comments/a2j6xk/how_does_re...




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: