LinkButton: use React.Fragment instead
This commit is contained in:
parent
13bc689305
commit
0e3224c52f
|
@ -12,17 +12,12 @@ class LinkButton extends React.Component
|
||||||
# We cannot just replace the button with a <Redirect/> when we switch
|
# We cannot just replace the button with a <Redirect/> when we switch
|
||||||
# because it will cause visual breaks where the button disappears for
|
# because it will cause visual breaks where the button disappears for
|
||||||
# a short while before the actual switch happens.
|
# a short while before the actual switch happens.
|
||||||
# Use <ins> as a dumb wrapper because it does not actually create
|
<React.Fragment>
|
||||||
# an element around our tags.
|
|
||||||
# (the semantics of <ins> is "inserted content", but this seems
|
|
||||||
# to be the only sane solution here)
|
|
||||||
# <https://stackoverflow.com/questions/14162035/how-to-wrap-arbitrary-html-with-a-wrapper-without-breaking-markup>
|
|
||||||
<ins>
|
|
||||||
<button {...@props} onClick={(e) => @setState { switch: true }}/>
|
<button {...@props} onClick={(e) => @setState { switch: true }}/>
|
||||||
{
|
{
|
||||||
@state.switch and
|
@state.switch and
|
||||||
<Redirect {...@props} />
|
<Redirect {...@props} />
|
||||||
}
|
}
|
||||||
</ins>
|
</React.Fragment>
|
||||||
|
|
||||||
export default LinkButton
|
export default LinkButton
|
Loading…
Reference in a new issue