Skip to content

Nên dịch thoát ý #2

Description

@ngminhtrung

Dịch thoát ý là được, không cần phải dịch từng từ.

Ví dụ lấy từ bài JSX in Depth

Đoạn gốc

if statements and for loops are not expressions in JavaScript, so they can't be used in JSX directly. Instead, you can put these in the surrounding code. For example:

function NumberDescriber(props) {
  let description;
  if (props.number % 2 == 0) {
    description = <strong>even</strong>;
  } else {
    description = <i>odd</i>;
  }
  return <div>{props.number} is an {description} number</div>;
}

Dịch

iffor không phải là expression trong JavaScript, do vậy không dùng trực tiếp trong JSX được, mà hãy xử lý trước khi đưa vào JSX như bên dưới:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions