Sign in
Log inSign up

Is it ideal to have a React app without state?

Juanita Sutton's photo
Juanita Sutton
·Aug 1, 2016

James states in this article, a way to have a React app without state; rendering without maintaining state at all.

// Handle updated values by re-rendering the app
function render(value) {
    ReactDOM.render(
        <CommentForm
            value={value}
            onChange={render}
        />,
        document.getElementById("react-app")
    )
}

// Initialise the app by rendering it
render({
    name: "James",
    message: "",
})

I can think of many ways, on how this could get ugly as far as the state is concerned, but I suspect this pattern doesn't also give the benefits of the virtual DOM, right? Can anyone technically prove that this is the case?

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2025 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct