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
|
||||
# because it will cause visual breaks where the button disappears for
|
||||
# a short while before the actual switch happens.
|
||||
# Use <ins> as a dumb wrapper because it does not actually create
|
||||
# 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>
|
||||
<React.Fragment>
|
||||
<button {...@props} onClick={(e) => @setState { switch: true }}/>
|
||||
{
|
||||
@state.switch and
|
||||
<Redirect {...@props} />
|
||||
}
|
||||
</ins>
|
||||
</React.Fragment>
|
||||
|
||||
export default LinkButton
|
Loading…
Reference in New Issue