Performance: Why Remix embraces web standards
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by leveraging native browser features and reducing JavaScript overhead.
export function action({ request }) {
// server handles form data
}
export default function Form() {
return (
<form method="post">
<input name="data" />
<button type="submit">Send</button>
</form>
);
}import React, { useState } from 'react'; function Form() { const [data, setData] = useState(''); const handleSubmit = (e) => { e.preventDefault(); fetch('/api/submit', { method: 'POST', body: JSON.stringify({ data }) }); }; return ( <form onSubmit={handleSubmit}> <input value={data} onChange={e => setData(e.target.value)} /> <button type="submit">Send</button> </form> ); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Native form submission | Minimal, uses browser default | Single reflow on submit | Low paint cost | [OK] Good |
| JavaScript-handled form submit | Extra event listeners and state | Multiple reflows due to JS updates | Higher paint cost | [X] Bad |