@lynx-js/react / GlobalPropsProvider

函数: GlobalPropsProvider()

function GlobalPropsProvider(props: object, deprecatedLegacyContext?: any): null | ReactElement<any, any>

The Provider Component that provide lynx.__globalProps, you must wrap your JSX inside it

参数

范围类型描述
propsobject-
props.children?ReactNode-
deprecatedLegacyContext?any已被弃用 参阅 React Docs

返回

null | ReactElement<any, any>

示例

import { root } from "@lynx-js/react"

function App() {
  return (
    <GlobalPropsConsumer children={(globalProps) => <view>...</view>}/>
  )
}

root.render(
  <GlobalPropsProvider>
     <App/>
  </GlobalPropsProvider>
);

定义于

@lynx-js/react/runtime/lib/lynx-api.d.ts:166

除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。