1. 코딩 스타일 가이드
1
Componentization
const Layout = ({ children }) => (
<div className="layout">
<header> Header content ... ... </header>
<main>{children}</main>
<footer> Footer content ... ... </footer>
</div>
);
export default Layout;import Header from '@/components/header';
import Footer from '@/components/footer';
const Layout = ({ children }) => (
<div className="layout">
<Header />
<main>{children}</main>
<Footer />
</div>
);
export default Layout;5
try-catch
async function fetchData() {
// An async function for fetching data from an API
try {
const response = await fetch('https://api.example.com/data');
if (!response.ok) {
throw new Error(`API call failed with status: ${response.status}`);
}
return await response.json();
} catch (error) {
// Error handling or logging logic
throw error;
}
}7
마지막 업데이트