Skip to content

Tag: svelte

Having trouble displaying object property

I’m building a small pokedex using PokeAPI. I’m retrieving data from an endpoint and building my own object. The function that I’ve built for the latter runs on page load as follows: I’m able to console log the object and traverse it in devtools, and also able to JSON stringify it and …

Capture value from an input with svelte

I’m trying to capture the value of an input using the svelte framework When initializing the local environment I already get the following error in the console: Uncaught TypeError: Cannot read properties of null (reading ‘value’) Visual Studio Code marks the code snippet .value when I try to…

Calling array object in src does not work

I have an array : I am looping in it: This here does not work: src={icon} Correct way should be like this: If I replace the {icon} with string it works! Can someone tell me why? Thank you Answer The reason this doesn’t work is because <Icon src=”xxx” /> does not expect a string but an …

Open one accordion section at a time. (Svelte)

I’d like to ask someone who can figure out how to allow this accordion component to open only one section at a time. It means that if a new accordion is open the previous one has to close automatically. In the ideal situation, this function could be optional for specific accordions. Thank you for your t…