<div>

Summary

<div> is the base container component.

::: tip

  • Don't add text in <div>directly. Use <text> instead.
  • In Weex, <div> cannot scroll.
  • Depth level of <div> should be controlled for better performance. We sugges lower than 14 depth level. :::

Child Components

<div> supports all kinds of components as it child including <div>.

Styles

Events

Rax Example

rax-view is the component <div> of rax, which can run in web and weex.

import { createElement, render } from 'rax';
import Driver from "driver-universal";
import View from "rax-view";

function App() {
  return <View
		style={{
		  width: '200rpx',
		  height: '200rpx',
		  backgroundColor: '#222831',
		}}
	/>;
}

render(<App />, document.body, { driver: Driver });

rax-view doc