# Backend configuration with S3 + DynamoDB locking
terraform {
backend "s3" {
bucket = "company-terraform-state"
key = "services/web-app/terraform.tfstate"
region = "us-east-1"
import { useCallback, useEffect, useState } from "react";
type Patch = Record<string, string | null | undefined>;
function readParams(): URLSearchParams {
return new URLSearchParams(window.location.search);
import React, { useState, useEffect, useCallback, useMemo, useRef, useContext } from 'react';
// 1. useState - managing component state
function Counter() {
const [count, setCount] = useState(0);
const [name, setName] = useState('');
export interface Todo {
id: string;
title: string;
done: boolean;
}
import { createContext } from "react";
export type ToastVariant = "info" | "success" | "error";
export interface Toast {
id: string;
export interface Post {
id: string;
body: string;
liked: boolean;
likeCount: number;
}
import React from 'react';
import { useToasts } from './useToasts';
export function Toaster() {
const { toasts, dismiss } = useToasts();
import { Injectable } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@Injectable()
export class SignupFormService {
readonly form: FormGroup;
import React, { createContext, useContext, useReducer, useState } from 'react';
// 1. Basic Context
const UserContext = createContext(null);
function UserProvider({ children }) {
import { useState, useEffect, useCallback } from 'react';
export function useLocalStorage(key, initialValue) {
const readValue = useCallback(() => {
if (typeof window === 'undefined') return initialValue;
try {