DEV Community

Discussion on: React's render() Doesn't... Render

Collapse
 
bytebodger profile image
Adam Nathaniel Davis

You bring up a good point here. As you know from my prior posts, I genuinely like the declarative syntax. But I feel strongly that there's a logical place for imperative commands - and it can get confusing when you try to shuffle the two together.

Maciej Sikora commented here that he thinks the naming of the render() function makes sense. I don't personally agree. But it hadn't occurred to me that, maybe the reason I feel differently, is because I still think, often, in imperative paradigms.

To me, every function should always be named after an action. And "rendering" is an action. But when you call render() and no changes are made to the DOM, IMHO, the function didn't do what it claimed to do.

To be clear, this is semantic. And I obviously don't expect anyone on the React team to change the naming conventions. In this particular post, I only write about it because, IMHO, that ambiguity leads to outright misunderstanding on the part of a lotta devs.

As I showed in my "Static Components" demo, there are many React devs who would swear that example leads to "unnecessary rerenders". But... it doesn't.