Closed cookpete closed 5 years ago
Due to the way React deals with whitespace in span, sometimes results can be a bit janky:
span
<Highlight search='s '>This is my test</Highlight>
Expected result: This is my test Actual result: Thisismy test
I guess because React is doing:
<span>Thi</span> <span>s </span> <span>i</span> <span>s </span> <span>my test</span>
and ignores the whitespace inside <span>s </span> because it isn't part of a string.
<span>s </span>
You can solve the problem by applying white-space: pre; to the spans, but perhaps that is fine to leave for the developer to deal with.
white-space: pre;
Due to the way React deals with whitespace in
span
, sometimes results can be a bit janky:Expected result: This is my test Actual result: Thisismy test
I guess because React is doing:
and ignores the whitespace inside
<span>s </span>
because it isn't part of a string.