
Build Your First PROJECT
Learn Ayisha.js by building a complete blog step by step. From basics to advanced features, master reactive programming with hands-on practice.
Setup & Basic HTML Structure
Let's start by creating the basic HTML structure for our blog. We'll include Ayisha.js and set up the initial layout.
π― Live Demo - Basic Setup
by
π Code Example
by
β¨ @text directive displays dynamic content and @model creates two-way data binding!
Adding State & Reactivity
Now let's add some interactive elements to our blog. We'll create a visitor counter and a welcome message.
π― Live Demo - Interactive Elements
Welcome to !
Visitors:
Current visitor count:
π Code Example
Welcome to !
Visitors:
β¨ @click directive executes JavaScript when elements are clicked. State updates trigger automatic re-renders!
Creating Dynamic Lists
Let's create a simple blog post list. We'll use the @for directive to iterate over an array of posts.
π― Live Demo - Blog Post List
No posts yet. Add your first post above! π
π Code Example
No posts yet. Add your first post above! π
β¨ @for creates dynamic lists and @key ensures optimal performance. @if conditionally renders elements!
Conditional Rendering & User Interactions
Let's add more sophisticated interactions. We'll implement post editing and show/hide functionality.
π― Live Demo - Interactive Posts
π Code Example
β¨ @if conditionally shows/hides elements. Complex expressions work perfectly for interactive UIs!
Loading Data from APIs
Let's load real blog posts from JSONPlaceholder API. We'll use the @fetch directive to make HTTP requests.
π― Live Demo - API Integration
Posts from JSONPlaceholder API:
Click the button above to load posts from the API! π
π Code Example
0">
Posts from JSONPlaceholder API:
User ID: | Post ID:
β¨ @fetch:click makes HTTP requests on user interaction. @result stores the response data!
Dynamic User Loading
Let's load user information dynamically based on user selection. We'll combine multiple API calls.
π― Live Demo - User Selection
Email:
Website:
Company:
Posts by :
π Code Example
Email:
Website:
β¨ URL interpolation with {variable} syntax allows dynamic API calls!
Form Validation
Let's add a contact form with validation. We'll use the @validate directive to ensure data quality.
π― Live Demo - Contact Form
Validation Status:
Name valid:
Email valid:
Phone valid:
Message valid:
π Code Example
β¨ @validate provides real-time validation. Check _validate object for validation results!
Search & Filter Functionality
Let's add search functionality to filter blog posts. We'll use JavaScript's array methods within Ayisha.js.
π― Live Demo - Search Posts
Found posts matching ""
First load some posts from Step 5 to use the search! π
π Code Example
p.title.toLowerCase().includes(searchQuery.toLowerCase()) || p.body.toLowerCase().includes(searchQuery.toLowerCase()))" placeholder="Search posts...">
Found posts matching ""
Post ID:
β¨ @input triggers on every keystroke. Complex filtering logic works seamlessly!
Comments System
Let's build a comments system for our blog posts. We'll load comments from the API and allow users to add new ones.
π― Live Demo - Post Comments
Comments for this post:
by
Add a Comment:
π Code Example
0">
Comments for this post:
by
Add a Comment:
β¨ Nested API calls and dynamic list manipulation create rich, interactive experiences!
Advanced Features & State Management
Let's wrap up with advanced features: state watching, animations, and a complete blog dashboard.
π― Live Demo - Blog Dashboard
Total Posts
Average Likes
Total Visitors
Your Blog Posts:
Debug State:
π Code Example
totalPosts = posts.length; avgLikes = posts.reduce((sum, p) => sum + p.likes, 0) / posts.length || 0">
Total Posts
Average Likes
Total Visitors
0">
Likes: | 5 ? 'Popular! π₯' : 'Getting started π'">
β¨ @watch monitors state changes, @animate adds smooth transitions, and @state helps with debugging!
π Congratulations!
You've completed the Ayisha.js blog tutorial!
You now know how to:
- β Create reactive user interfaces
- β Handle user interactions and events
- β Work with APIs and external data
- β Implement form validation
- β Build dynamic search and filtering
- β Manage complex application state
- β Create engaging user experiences