3

I have a very simple x-for array loop using Alpine.js. I can’t seem to figure out why it is repeating multiple times.

<ul x-data="{ skills: ['AWS', 'Terraform', 'PHP', 'Node.js', 'Vue.js', 'Golang', 'Laravel', 'Hugo', 'Docker', 'MySQL', 'Redis', 'Elasticsearch', 'API Design', 'HTML5', 'CSS3', 'Tailwind CSS', 'EC2', 'Lambda', 'RDS', 'ECS', 'S3', 'API Gateway', 'DynamoDB', 'Cloudfront', 'Cloudwatch', 'SQS'] }">
  <template x-for="skill in skills" :key="skill">
    <li x-text="skill" class="inline-block text-xs bg-gray-200 text-gray-700 rounded-full py-1 px-3 mr-2 mb-2"></li>
  </template>
</ul>

https://jsfiddle.net/y9wbz3dg/1/

0

2 Answers 2

4

Thanks to a tip from Twitter I was able to determine that this is caused by not using the "defer" keyword when including the script.

<script defer src="https://unpkg.com/[email protected]/dist/cdn.min.js"></script>
Sign up to request clarification or add additional context in comments.

Comments

0

I found that i was including AlpineJs twice, once at <head> and another before </body>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.