0

How does the browser remember that space has to be inserted between both span element to show Hello World without having any information about it inside the markup

const element = React.createElement('div',{
                   children:[
                      React.createElement('span',null,'Hello'),
                      ' ',
                      React.createElement('span',null,'Hello')
                   ]
                })

But when I saw the mark-up which was rendered in the markup was

<div>
   <span>Hello</span>
   <span>World</span>
</div>
Akash Singh
  • 547
  • 5
  • 8

2 Answers2

1

Your question is not about "how browser remembers" (HTML entities) but "why I don't see space in dev tools".

You can see the space in Accessibility tab:

enter image description here

If you want to "see the space" as an elemet you can use non-breaking space:

<span>Hello</span>&nbsp;<span>World</span>

enter image description here

Dennis Vash
  • 50,196
  • 9
  • 100
  • 118
0

Because browsers understand elements when reading HTML so just a space " " won't do anything. Try adding a span with space in his innerHTML

Stelios
  • 5
  • 1