πŸ“˜
Lif31up's Blog
  • Welcome! I'm Myeonghwan
  • How to Read the Pages
  • Fundamental Machine Learning
    • Foundational Work of ML: Linear/Logistic Regression
    • Early-stage of AI: Perceptron and ADALINE
    • What is Deep Learning?: Artificial Neural Network to Deep Neural Network
    • * Challenges in Training Nerual Network
  • Meta Learning
    • Overview on Meta Learning
    • Prototypical Networks for Few-shot Learning
    • Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks
  • Natural Language Process
    • Bag-of-Words
  • Actionale AI
    • * Overview on Actionable AI
  • Front-end Development
    • Overview on Front-end Development
    • Learning React Basic
      • React Component: How They are Rendered and Behave in Browser
      • State and Context: A Key Function to Operate the React Application
      • Design Pattern for Higher React Programming
  • Songwriting
    • A Comprehensive Guide to Creating Memorable Melodies through Motif and Phrasing
  • Sound Engineering
    • How to Install and Load Virtual Studio Instruments
    • A Guide to Audio Signal Chains and Gain Staging
    • Equalizer and Audible Frequency: How to Adjust Tone of the Signal
    • Dynamic Range: the Right Way to Compress your Sample
    • Acoustic Space Perception and Digital Reverberation: A Comprehensive Analysis of Sound Field Simulat
  • Musical Artistry
    • What is Artistry: in Perspective of Modern Pop/Indie Artists
    • Visualizing as Musical Context: Choose Your Aesthetic
    • Analysis on Modern Personal Myth and How to Create Your Own
    • Instagram Management: Business Approach to Your Social Account
  • Art Historiography
    • Importance of Art Historiography: Ugly and Beauty Across Time and Space
    • Post-internet Art, New Aesthetic and Post-Digital Art
    • Brutalism and Brutalist Architecture
Powered by GitBook
On this page
  1. Front-end Development

Learning React Basic

λ¦¬μ•‘νŠΈ(react)λŠ” 페이슀뢁/λ©”νƒ€μ—μ„œ κ°œλ°œν•œ UIλ₯Ό λ Œλ”λ§ν•˜κΈ° μœ„ν•œ κ°•λ ₯ν•œ μžλ°”μŠ€ν¬λ¦½νŠΈ λΌμ΄λΈŒλŸ¬λ¦¬μž…λ‹ˆλ‹€. 이 λΌμ΄λΈŒλŸ¬λ¦¬λŠ” λ³΅μž‘ν•œ μ›Ή μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ˜ μΈν„°νŽ˜μ΄μŠ€λ₯Ό μž‘κ³  독립적이며 μž¬μ‚¬μš© κ°€λŠ₯ν•œ μš”μ†Œλ“€λ‘œ λΆ„ν•΄ν•˜μ—¬ ꡬ성할 수 있게 ν•΄μ£Όλ©°, 이λ₯Ό 톡해 κ°œλ°œμžλ“€μ€ λ”μš± 효율적이고 μœ μ§€λ³΄μˆ˜κ°€ μš©μ΄ν•œ μ½”λ“œλ₯Ό μž‘μ„±ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

  • μ»΄ν¬λ„ŒνŠΈ μ€‘μ‹¬μ˜ 섀계(component-based architecture): λ¦¬μ•‘νŠΈλŠ” μ‚¬μš©μž μΈν„°νŽ˜μ΄μŠ€λ₯Ό μž¬μ‚¬μš© κ°€λŠ₯ν•œ 독립적 μš”μ†Œλ“€λ‘œ λΆ„ν•΄ν•˜λŠ” 방식을 μ±„νƒν•©λ‹ˆλ‹€.

    • 각 μš”μ†ŒλŠ” 자체적인 논리와 μƒνƒœλ₯Ό κ°€μ§€λ©°, μ΄λŸ¬ν•œ κ΅¬μ‘°λŠ” μ½”λ“œμ˜ λͺ¨λ“ˆν™”와 μœ μ§€λ³΄μˆ˜λ₯Ό λ”μš± 효율적으둜 λ§Œλ“­λ‹ˆλ‹€.

  • 가상 돔(Virtual DOM): λ¦¬μ•‘νŠΈλŠ” 가상 돔을 μ‚¬μš©ν•΄ λ Œλ”λ§μ„ μ΅œμ ν™”ν•©λ‹ˆλ‹€. μ‹€μ œ 돔과 직접 μ—°κ²°ν•˜λŠ” λŒ€μ‹ , κ°€λ²Όμš΄ 가상 볡사본을 λ§Œλ“€μ–΄ ν•„μš”ν•œ λΆ€λΆ„λ§Œ κ°±μ‹ ν•˜κ³  μ‘°μž‘ν•©λ‹ˆλ‹€.

  • JSX 문법(JSX syntax): λ¦¬μ•‘νŠΈλŠ” μžλ°”μŠ€ν¬λ¦½νŠΈ μ•ˆμ— HTML을 μž‘μ„±ν•  수 μžˆλŠ” κ³ μœ ν•œ 문법을 μ œκ³΅ν•©λ‹ˆλ‹€. 이λ₯Ό 톡해 κ°œλ°œμžλŠ” UI μ½”λ“œμ™€ λ Œλ”λ§μ„ 더 μ§κ΄€μ μœΌλ‘œ 이해할 수 μžˆμŠ΅λ‹ˆλ‹€.

  • μƒνƒœμ™€ ν”„λ‘­μŠ€ 관리(state and props management): μƒνƒœλŠ” μ»΄ν¬λ„ŒνŠΈ λ‚΄λΆ€μ—μ„œ κ΄€λ¦¬λ˜λŠ” 동적인 데이터 μ €μž₯μ†Œμž…λ‹ˆλ‹€. ν”„λ‘­μŠ€λŠ” λΆ€λͺ¨κ°€ μžμ‹ μš”μ†Œμ—κ²Œ μ „ν•΄μ£ΌλŠ” 읽기 μ „μš©μ˜ μžλ£Œμž…λ‹ˆλ‹€.

    • 후크(hook): ν›„ν¬λŠ” μƒνƒœ 관리λ₯Ό κ°„λ‹¨ν™”ν•˜κΈ° μœ„ν•΄ 16.8 버전뢀터 μΆ”κ°€λœ 곡식적인 λ””μžμΈ νŒ¨ν„΄μž…λ‹ˆλ‹€.

  • λ¦¬μ•‘νŠΈ λΌμš°ν„°(react router): ν΄λΌμ΄μ–ΈνŠΈκ°€ 슀슀둜 λΌμš°νŒ…μ„ ν•  수 있게 λ§Œλ“œλŠ” κΈ°λŠ₯μž…λ‹ˆλ‹€.

ν˜„λŒ€μ˜ μ›Ή κ°œλ°œμ—μ„œ λ¦¬μ•‘νŠΈμ˜ μœ„μΉ˜

  • Angular, Vue와 ν•¨κ»˜ ν˜„μž¬ κ°€μž₯ 널리 μ‚¬μš©λ˜λŠ” ν”„λ‘ νŠΈμ—”λ“œ λΌμ΄λΈŒλŸ¬λ¦¬μž…λ‹ˆλ‹€. λ„·ν”Œλ¦­μŠ€, μΈμŠ€νƒ€κ·Έλž¨, 페이슀뢁, 에어비엔비 λ“± λ§Žμ€ 기업듀이 λ¦¬μ•‘νŠΈλ₯Ό μ±„νƒν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

  • Redux, React Native, Material-UI, Webpack, Vite, Babel λ“± λ‹€μ–‘ν•œ 도ꡬ와 ν™•μž₯ 라이브러리λ₯Ό μ§€μ›ν•©λ‹ˆλ‹€.

  • GraphQL, REST APIs, WebSocket λ“± λ‹€μ–‘ν•œ ν”„λ ˆμž„μ›Œν¬μ™€ ν˜Έν™˜λ˜μ–΄ 높은 μœ μ—°μ„±μ„ μ œκ³΅ν•©λ‹ˆλ‹€.

Writing a Component

λ¦¬μ•‘νŠΈ μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ€ μ»΄ν¬λ„ŒνŠΈ(component)λΌλŠ” μž¬μ‚¬μš© κ°€λŠ₯ν•œ μ‚¬μš©μž μΈν„°νŽ˜μ΄μŠ€ μ‘°κ°λ“€λ‘œ κ΅¬μ„±λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. μ΄λŸ¬ν•œ μš”μ†Œλ“€μ€ 독립적이고 λͺ¨λ“ˆν™”λœ ꡬ쑰λ₯Ό κ°€μ§€λ©°, 각각 λ§ˆν¬μ—…μœΌλ‘œ λ³€ν™˜λ˜λŠ” μžλ°”μŠ€ν¬λ¦½νŠΈ ν•¨μˆ˜μ˜ ν˜•νƒœλ₯Ό λ±λ‹ˆλ‹€. 각 μš”μ†ŒλŠ” 자체적인 둜직과 μƒνƒœλ₯Ό κ°€μ§ˆ 수 있으며, λ‹€λ₯Έ μš”μ†Œλ“€κ³Ό μ‘°ν•©λ˜μ–΄ λ³΅μž‘ν•œ μ‚¬μš©μž μΈν„°νŽ˜μ΄μŠ€λ₯Ό κ΅¬μΆ•ν•˜λŠ” 데 μ‚¬μš©λ©λ‹ˆλ‹€.

μ½”λ“œ
function Profile(){
	return (
		<img src="<https://i.imgur.com/MK3eW3As.jpg>" alt="Katherine Johnson"/>
	);
}

export default function Gallery(){
	return (
		<section>
			<h1>Amazing Scientists</h1>
			<Profile />
			<Profile />
			<Profile />
		</section>
	);
}

Markup and JSX

λ¦¬μ•‘νŠΈμ—μ„œ 각 μš”μ†ŒλŠ” λ§ˆν¬μ—…μ„ ν¬ν•¨ν•˜λŠ” ν•˜λ‚˜μ˜ ν•¨μˆ˜μž…λ‹ˆλ‹€. 이λ₯Ό μž‘μ„±ν•˜κΈ° μœ„ν•΄ JSXλΌλŠ” νŠΉλ³„ν•œ 문법을 μ‚¬μš©ν•©λ‹ˆλ‹€. HTMLκ³Ό μœ μ‚¬ν•˜μ§€λ§Œ, 동적인 정보 전달을 μœ„ν•΄ 더 μ—„κ²©ν•˜κ²Œ μ„€κ³„λ˜μ—ˆμŠ΅λ‹ˆλ‹€. κ·Έλž˜μ„œ JSXλŠ” λ§ˆν¬μ—…κ³Ό λ‹€λ₯Έ λ…νŠΉν•œ 문법 κ·œμΉ™μ„ κ°€μ§€κ³  μžˆμ–΄, 일반적인 λ§ˆν¬μ—…μ—μ„œ ν—ˆμš©λ˜λŠ” λ‹€μŒκ³Ό 같은 문법이 였λ₯˜λ₯Ό λ°œμƒμ‹œν‚΅λ‹ˆλ‹€.

μ½”λ“œ
export default function TodoList() {
  return (
    <h1>Hedy Lamarr's Todos</h1>
    <img
      src="<https://i.imgur.com/yXOvdOSs.jpg>"
      alt="Hedy Lamarr"
      class="photo"
    >
    <ul>
      <li>Invent new traffic lights
      <li>Rehearse a movie scene
      <li>Improve spectrum technology
    </ul>
  );
}

JSXλŠ” μžλ°”μŠ€ν¬λ¦½νŠΈμ˜ λ…Όλ¦¬λ‚˜ 동적 νŠΉμ§• μ°Έμ‘°λ₯Ό λ§ˆν¬μ—…μ— ν¬ν•¨μ‹œν‚¬ 수 있게 ν•©λ‹ˆλ‹€. μ΄λ•Œ {}λ₯Ό μ‚¬μš©ν•˜λ©° 이λ₯Ό 창을 μ—°λ‹€(open a window)라 ν‘œν˜„ν•©λ‹ˆλ‹€.

μ½”λ“œ
const person = {
  name: 'Gregorio Y. Zara',
  theme: {
    backgroundColor: 'black',
    color: 'pink'
  }
};

export default function TodoList() {
  return (
    <div style={person.theme}>
      <h1>{person.name}'s Todos</h1>
      <img
        className="avatar"
        src="<https://i.imgur.com/7vQD0fPs.jpg>"
        alt="Gregorio Y. Zara"
      />
      <ul>
        <li>Improve the videophone</li>
        <li>Prepare aeronautics lectures</li>
        <li>Work on the alcohol-fuelled engine</li>
      </ul>
    </div>
  );
}

Props Propagation

λ¦¬μ•‘νŠΈλŠ” ν”„λ‘­(props)을 톡해 μ»΄ν¬λ„ŒνŠΈ κ°„ μƒν˜Έμž‘μš©μ„ ν•©λ‹ˆλ‹€. λΆ€λͺ¨ μ»΄ν¬λ„ŒνŠΈκ°€ μžμ‹ μ»΄ν¬λ„ŒνŠΈμ—κ²Œ 프둭을 μ „λ‹¬ν•˜μ—¬ 데이터λ₯Ό μ£Όκ³ λ°›λŠ” 것을 ν”„λ‘­μŠ€ μ „νŒŒ(props propagation)라고 ν•©λ‹ˆλ‹€.

μ½”λ“œ
import { getImageUrl } from './utils.js'

export default function Profile() {
  return (
    <Card>
      <Avatar
        size={100}
        person={{
          name: 'Katsuko Saruhashi',
          imageId: 'YfeOqp2'
        }}
      />
    </Card>
  );
}

function Avatar({ person, size }) {
  return (
    <img
      className="avatar"
      src={getImageUrl(person)}
      alt={person.name}
      width={size}
      height={size}
    />
  );
}

function Card({ children }) {
  return (
    <div className="card">
      {children}
    </div>
  );
}

Conditional Rendering

μ»΄ν¬λ„ŒνŠΈκ°€ ν‘œμ‹œλ˜λŠ” 방식은 상황에 따라 λ‹€λ₯Ό 수 μžˆμŠ΅λ‹ˆλ‹€. JSXλŠ” μžλ°”μŠ€ν¬λ¦½νŠΈμ˜ if, &&, ? : μ—°μ‚°μžλ₯Ό μ‚¬μš©ν•˜μ—¬ 쑰건뢀 λ Œλ”λ§μ„ κ΅¬ν˜„ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

μ½”λ“œ
function Item({ name, isPacked }) {
  return (
    <li className="item">
      {name} {isPacked && 'βœ”'}
    </li>
  );
}

export default function PackingList() {
  return (
    <section>
      <h1>Sally Ride's Packing List</h1>
      <ul>
        <Item
          isPacked={true}
          name="Space suit"
        />
        <Item
          isPacked={true}
          name="Helmet with a golden leaf"
        />
        <Item
          isPacked={false}
          name="Photo of Tam"
        />
      </ul>
    </section>
  );
}
PreviousOverview on Front-end DevelopmentNextReact Component: How They are Rendered and Behave in Browser

Last updated 4 days ago