Giving root as null (DOMless rendering)

I wanted to display zero in the root, so I can have a complete tree that displays zero, but just use the React component. (/ his life methods).

Here is some information about the "return of the zero concept": https://github.com/joshwcomeau/return-null - talk about lighting from the conf reaction.

I am making an electronic application. In the main area there is no dom. In this main area (index.js) I have a redux repository, I return null in the whole tree, including the root. However, I cannot initially do this because for the initial rendering I need to use ReactDOM.render as follows:

ReactDOM.render(<AllNullStuff />, document.getElementById('something')) 

I don't have a DOM, is there any way to do this?

If I try null as root, I get an error:

Error: _registerComponent (...): The target container is not a DOM element.

Is there a way to render a fully null tree so that the DOM is not required?

+5
source share
1 answer
  • Electron has a DOM.
  • If you do not have a DOM, this means that there is no way to do this. How do you create a DOM where it does not exist?
  • Check p1, you have the DOM in the electronic application, and after some configurations completely match the development of the website, it looks like you are doing something wrong.
  • You cannot have a tree. Yes, you can put zero in any other tag, but zero itself cannot have children.

Like this.

If you pass null to #root, it will be displayed as an empty tag, but inside it is not possible.

 render() { return null; //how to put child tags in it? No way... } 
0
source

Source: https://habr.com/ru/post/1270342/


All Articles