question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Add ReactDOM.renderSync(...) method

See original GitHub issue

Do you want to request a feature or report a bug? feature

What is the current behavior? ReactDOM.render(...) is an async operation

What is the expected behavior? Would be very nice if there was something like ReactDOM.renderSync method that would interrupt all pending operations and render the Element and put it in DOM immediately.

Very critical for my current use case (willing to explain if need be)

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

16.x.x

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jquensecommented, Mar 25, 2018

It seems like createPortal is exactly what you want?

0reactions
cjativacommented, Sep 17, 2021

Question on this maybe @jquense or @gaearon can answer; is ReactDOM.createPortal(...) synchronous?

It doesn’t accept a callback function, and when I check the container element (via debugging), the provided React node has not been added into the container.

Is there anyway I can listen for when the node has been placed into the container? Code below

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactDOM
The react-dom package provides DOM-specific methods that can be used at the top ... It may be possible to insert a component to...
Read more >
How do I do a synchronous ReactDOM.render
You can pass a callback to ReactDOM.render(ReactElm, DOMNode, callback) . The callback will be executed once the ReactElm gets loaded into ...
Read more >
Managing DOM components with ReactDOM
Learn to expertly manage DOM components in a React app, including a deep dive into each ReactDOM method, with this comprehensive tutorial.
Read more >
A Closer Look at ReactDOM.render - The Need to Know ...
ReactDOM is a package that provides methods that can be used to interact with the DOM, which is needed to insert or update...
Read more >
ReactJS | ReactDOM
This is one of the most important methods of ReactDOM. This function is used to render a single React Component or several Components ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found