params

Description

The params variable is a default prop loaded by the Plenti generator automatically. It holds all the key/value pairs from the query string (everything after a ?) of the URL in a URLSearchParams object. This can be helpful when interacting with APIs that use callback URLs with specific parameters.

Getting values out of params

The params prop won't work with server-side rendering (SSR) so you need to check if the params are available first, before trying to use them. If you have a URL like http://localhost:3000/?cat=nemo&dog=pepper, you could access those values in your template like this:

{#if params}
  {params.get('cat')}
  {params.get('dog')}
{/if}