Skip to content

Force component to re-render (like Livewire $refresh) #4319

Answered by SimoTod
jacksleight asked this question in 1. Help
Discussion options

You must be logged in to vote

You need observable variables (something from x-data or something using Alpine.reactive) to have reactive directives in Alpine so the correct way to do it is

<div
	x-data="{ show: false }"
	x-resize.document="show = someConditionInvolvingViewportSize"
	x-show="show">
  ok
</div>

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@SimoTod
Comment options

@jacksleight
Comment options

@SimoTod
Comment options

@ekwoka
Comment options

Answer selected by jacksleight
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants