Skip to content

Instantly share code, notes, and snippets.

@goertzenator
Created January 15, 2025 14:05
Show Gist options
  • Save goertzenator/dc9e2c16d2d003de1e2956d40172bc86 to your computer and use it in GitHub Desktop.
Save goertzenator/dc9e2c16d2d003de1e2956d40172bc86 to your computer and use it in GitHub Desktop.
htmx in react
import { useEffect } from "react";
import htmx from "htmx.org";
import 'htmx-ext-sse/sse.js';
function AtsHome() {
useEffect(() => {
htmx.process(htmx.find("*"));
}, []);
return <div
hx-get="/h/home"
hx-trigger="load"
>
</div>
}
export default AtsHome;
@goertzenator
Copy link
Author

In package.json my dependencies were...

    "htmx-ext-sse": "^2.2.2",
    "htmx.org": "^2.0.2",

The SSE bits are optional of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment