<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hashan Lakruwan</title>
    <description>The latest articles on DEV Community by Hashan Lakruwan (@hashan2kk2).</description>
    <link>https://dev.to/hashan2kk2</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3657029%2F66afe318-30e1-4964-ad04-dae56f36e577.png</url>
      <title>DEV Community: Hashan Lakruwan</title>
      <link>https://dev.to/hashan2kk2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hashan2kk2"/>
    <language>en</language>
    <item>
      <title>How to Build AI-Powered React Apps in 2025</title>
      <dc:creator>Hashan Lakruwan</dc:creator>
      <pubDate>Thu, 11 Dec 2025 10:01:54 +0000</pubDate>
      <link>https://dev.to/hashan2kk2/how-to-build-ai-powered-react-apps-in-2025-1pcf</link>
      <guid>https://dev.to/hashan2kk2/how-to-build-ai-powered-react-apps-in-2025-1pcf</guid>
      <description>&lt;p&gt;In 2025, "AI Integrated" is no longer a feature—it's a requirement.&lt;/p&gt;

&lt;p&gt;As a &lt;a href="https://www.hashanlakruwan.me/" rel="noopener noreferrer"&gt;Full-Stack Developer&lt;/a&gt;, I've seen a massive shift in client demands. Everyone wants a chatbot, a summarizer, or a generative UI.&lt;/p&gt;

&lt;p&gt;Today, I’ll show you how to get started with the Vercel AI SDK to build a streaming chat interface in Next.js 16.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Vercel AI SDK?
&lt;/h2&gt;

&lt;p&gt;Building AI apps used to mean dealing with complex WebSocket servers and managing streaming state manually. The Vercel AI SDK handles all of that for you.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Streaming First: Built-in support for streaming responses.&lt;/li&gt;
&lt;li&gt;Provider Agnostic: Switch between OpenAI, Anthropic, or Mistral easily.&lt;/li&gt;
&lt;li&gt;React Hooks: &lt;code&gt;useChat&lt;/code&gt; and &lt;code&gt;useCompletion&lt;/code&gt; make integration a breeze&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Quick Start Guide&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Install Dependencies&lt;br&gt;
&lt;code&gt;npm install ai @ai-sdk/openai&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create an API Route&lt;br&gt;
In &lt;code&gt;app/api/chat/route.ts&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { openai } from '@ai-sdk/openai';
import { streamText } from 'ai';
export const maxDuration = 30;
export async function POST(req: Request) {
  const { messages } = await req.json();
  const result = streamText({
    model: openai('gpt-4o'),
    messages,
  });
  return result.toDataStreamResponse();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Build the UI
In your component &lt;code&gt;page.tsx&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'use client';
import { useChat } from 'ai/react';
export default function Chat() {
  const { messages, input, handleInputChange, handleSubmit } = useChat();
  return (
    &amp;lt;div className="flex flex-col w-full max-w-md py-24 mx-auto stretch"&amp;gt;
      {messages.map(m =&amp;gt; (
        &amp;lt;div key={m.id} className="whitespace-pre-wrap"&amp;gt;
          {m.role === 'user' ? 'User: ' : 'AI: '}
          {m.content}
        &amp;lt;/div&amp;gt;
      ))}
      &amp;lt;form onSubmit={handleSubmit}&amp;gt;
        &amp;lt;input
          className="fixed bottom-0 w-full max-w-md p-2 mb-8 border border-gray-300 rounded shadow-xl"
          value={input}
          placeholder="Say something..."
          onChange={handleInputChange}
        /&amp;gt;
      &amp;lt;/form&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The "Generative UI" Trend
&lt;/h2&gt;

&lt;p&gt;The next big thing is Generative UI—where the AI doesn't just return text, but returns React Components.&lt;/p&gt;

&lt;p&gt;Imagine asking a travel bot for a flight, and instead of text, it renders a clickable Ticket Component. This is the future of UX.&lt;/p&gt;

&lt;p&gt;I'm currently experimenting with these patterns on my own projects. If you're interested in advanced Next.js architecture or need a hand with your AI implementation, feel free to check out my work or get in touch:&lt;/p&gt;

&lt;p&gt;Check out my portfolio&lt;br&gt;
&lt;a href="https://www.hashanlakruwan.me/" rel="noopener noreferrer"&gt;hashanlakruwan.me&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
The barrier to entry for building AI apps has never been lower. The real challenge now is building useful UX around them.&lt;/p&gt;

&lt;p&gt;What AI features are you building this year? Let me know in the comments! 👇&lt;/p&gt;

</description>
      <category>react</category>
      <category>nextjs</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
