Ben resmi typescript dokümanlar yer alan talimatları izleyerek daktilo ile bileşenleri tepki yazıyorum yazılmış tepki kılmasıdır ama V8Js kullanarak doğru yolun ne olduğunu anlamadan yoksun gibi görünüyor.PHP V8Js typescript
bu benim tepki uygulamadır: (render istemci tarafı) Ben yandan sunucuda kılmaya çalıştı
http://codepen.io/MasterScripter/pen/xqRZQO
:
<?php
$v8 = new V8Js();
$react = [];
// stubs, react
$react[] = "var console = {warn: function(){}, error: print}";
$react[] = "var global = {}";
$react[] = file_get_contents('./dist/react.js');
$react[] = "var React = global.React";
$react[] = file_get_contents('./dist/bundle.js');
$data = [
'value' => 1,
'onClick' => 'function'
];
$react[] = sprintf(
"React.renderComponentToString(Square({data: %s}), print)",
json_encode($data));
$react = implode(";", $react);
try {
$v8->executeString($react);
} catch(V8JsException $e) {
echo "
File: {$e->getJsFileName()} \n
Line Number: {$e->getJsLineNumber()} \n
Source Line: {$e->getJsSourceLine()} \n
Trace: {$e->getJsTrace()}
";
}
'react.js' ham & tepki içerir tepki dom kodu, 'bundle.js', yukarıdaki kalemden biriyle aynı olan web paketi paketini içerir.
bu hatayı alıyorum:
File: V8Js::compileString()
Line Number: 209
Source Line: module.exports = ReactDOM;
Trace: ReferenceError: ReactDOM is not defined
at Object.setPrototypeOf.__proto__ (V8Js::compileString():209:18)
at __webpack_require__ (V8Js::compileString():47:30)
at Object.<anonymous> (V8Js::compileString():300:16)
at __webpack_require__ (V8Js::compileString():47:30)
at module.exports (V8Js::compileString():93:18)
at V8Js::compileString():96:10
düzgün bunu nasıl herhangi bir öneri/ipuçları? Eğer
$react[] = "var React = global.React, ReactDOM = global.ReactDOM, ReactDOMServer = global.ReactDOMServer;";
yerine
$react[] = "var React = global.React";
(ben bunu test etmedim
ait eklemeniz gerekir gibi