-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Description
Console errors get logged when the ReactJS::js method is called, including:
Warning: Something is calling a React component directly. Use a factory or JSX instead. See: http://fb.me/react-legacyfactory
I also had problems getting this method working at all, but that may have been due to other factors. Anyway, I rewrote it to suppress the errors, like this:
public function js($element, $return_var = null)
{
$component_name = $this->component;
$react = $this->react_prefix . 'React';
$data = json_encode($this->data);
$assignment = $return_var ? "$return_var = " : '';
return "var component = $react.createFactory($component_name);\n" .
"$assignment $react.render(component($data), document.querySelector('$element'));\n"
;
}
Metadata
Metadata
Assignees
Labels
No labels