Files
freeCodeCamp/guide/arabic/react-native/props/index.md
Randell Dawson d6a160445e Convert single backtick code sections to triple backtick code sections for Arabic Guide articles (13 of 15) (#36240)
* fix: converted single to triple backticks13

* fix: added prefix

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: removed language in wrong place

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add language postfix

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: removed language in wrong place

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>
2019-06-20 18:07:24 -05:00

1.9 KiB

title, localeTitle
title localeTitle
Props الدعائم

رد الفعل الأصلية - الدعائم

المصطلح الدعائم ، اختصارًا لـ "الخصائص" ، يعني نوعًا من البيانات التي يتم تمريرها من أحد المكونات إلى آخر. تتدفق الدعائم دائمًا من المكون الرئيسي إلى الطفل.

في React ، يستطيع المكون الفرعي الوصول إلى المعلومات من أحد الوالدين عبر الدعائم:

// the child Header component receives the text prop and can access it via this.props.text
class Header extends Component {
  render () {
    return (
      <Text>{this.props.text}</Text>
    )
  }
}

class App extends Component {
  render () {
    return (
      <Header text="Welcome!" />
    );
  }
}

هذا أيضا يعمل بنفس الطريقة في المكونات الوظيفية:

`// in functional components, props will be received as a parameter 'props' const Header = (props) => { return ( {props.title} ); };

class App extends Component { render () { return (

); } } `

ستتيح لك المكتبات الأخرى التي تقوم باستيرادها الوصول إلى خصائص إضافية داخل المكونات الخاصة بك. فيما يلي مثال من مكتبة العناصر المتفاعلة الأصلية .

``import { Button } from 'react-native-elements';

// here 'buttonStyle' and 'title' are props passed into the Button component class App extends Component { render () { return ( <Button buttonStyle={{backgroundColor: 'red', borderRadius: 10}} title={Submit} /> ); } } ``