1.0.0 • Published 4 years ago

svelte-key v1.0.0

Weekly downloads
31
License
WTFPL
Repository
github
Last release
4 years ago

svelte-key

Emulates React's key feature: force some content (e.g. some component) to be recreated when the value of the key changes.

This is based on the hack described in this StackOverflow answer (or this comment).

This feature might make it into Svelte eventually. Progress can be tracked in this issue.

Installation

npm install --dev svelte-key
yarn add --dev svelte-key

Usage

<script>
	import Identity from 'svelte-key'
	let i = 0
</script>

<p>Change input value & click button</p>

<Identity key={i}>
	<input />
</Identity>

<button on:click={() => {i++}}>
	{i}
</button>

License

WTFPL

1.0.0

4 years ago

0.0.1-2

4 years ago

0.0.1-1

4 years ago

0.0.1-0

4 years ago