widget/react

Types

React 컴포넌트 참조

pub type Component

Mendix가 전달하는 props 객체

pub type JsProps
pub type Props

React가 렌더링하는 요소

pub type ReactElement

React ref 객체

pub type Ref(a)

Values

pub fn component(
  comp: Component,
  props: Props,
  children: List(ReactElement),
) -> ReactElement

React 컴포넌트 합성

pub fn el(
  tag: String,
  props: Props,
  children: List(ReactElement),
) -> ReactElement

범용 HTML 요소 생성

pub fn el_(
  tag: String,
  children: List(ReactElement),
) -> ReactElement

props 없이 자식만으로 요소 생성

pub fn fragment(children: List(ReactElement)) -> ReactElement

Fragment로 여러 자식을 감싸기

pub fn keyed_fragment(
  key: String,
  children: List(ReactElement),
) -> ReactElement

key가 있는 Fragment

pub fn none() -> ReactElement

null 렌더링 (아무것도 표시하지 않음)

pub fn text(content: String) -> ReactElement

텍스트 노드

pub fn void(tag: String, props: Props) -> ReactElement

self-closing 요소 (input, img, br 등)

pub fn when(
  condition: Bool,
  element_fn: fn() -> ReactElement,
) -> ReactElement

Bool 기반 조건부 렌더링

pub fn when_some(
  option: option.Option(a),
  render_fn: fn(a) -> ReactElement,
) -> ReactElement

Option 기반 조건부 렌더링

Search Document