() => this.someCallback()
- это сохранит эквивалентность props и React не будет лишний раз вызывать render. Напримерclass MyComponent extends React.Component {
onBtnClick = (event) => {
// correct this
};
onBtnMouseUp() {
// invalid this
}
render() {
return <button onClick={this.onBtnClick} onMouseUp={this.onBtnMouseUp}>hello</button>;
}
}
<?php
spl_autoload_extensions('.php');
spl_autoload_register();
$class = 'Foo_Bar';
if (class_exists($class)) {
echo 'exists';
} else {
echo 'not exists';
}
<?php
$data = <<<XML
<document>
<bank name="Kazkommertsbank JSC">
<customer name="TERRA" mail="test@mail.ru" phone="">
<merchant cert_id="00c15670b" name="ZARA’S GROUP">
<order order_id="374565664" amount="8000" currency="398">
<department merchant_id="92451103" amount="8000"/>
</order>
</merchant>
<merchant_sign type="RSA"/>
</customer>
<customer_sign type="RSA"/>
<results timestamp="2017-01-26 15:21:21">
<payment merchant_id="9256е1103" card="548318-XX-XXXX-0293" amount="8000" reference="17012562121" approval_code="152121" response_code="00" Secure="No" card_bin="" c_hash="D643983890D0003EA973E88A346CDDBE"/>
</results>
</bank>
<bank_sign cert_id="00c154690" type="SHA/RSA">
k72PKDHhQ2QMyi8eGH7SRf4+4q4h3TTjTS4x+XIIpubT/kR67yTbKSYYRFg6iUv6NROx6SCm+hVJoaztBk/2QVU47FlIFe60iMVliONSIZ5RvLvYZwy/2q2b7vLiav8ZKOFahLb7NfhoBrNJeNKUFEXYn3EKKx2ojiMj7jWr/Q8=
</bank_sign>
</document>
XML;
$xml = new SimpleXMLElement($data);
var_dump((int) $xml->xpath('//order')[0]->attributes()['order_id']);
int(374565664)