There is such a simple (unnecessary specially cut) component:
import React, { Component } from 'react'; class QueryParamSelect extends Component { render() { return ( <div> {JSON.stringify(this.props)} </div> ) } } export default QueryParamSelect; I bring it to the back-end framework template as follows:
%QueryParamSelect{ label: 'Label', options: @options, param: 'rts' } Which is equivalent to this:
<queryparamselect label="Label" options="[["all", "All"], ["first", "First"], ["second", "Second"]]" param="rts"></queryparamselect> Well, to make this whole thing work, I use it:
document.addEventListener('DOMContentLoaded', () => { if (document.getElementById('query-param-select')) { ReactDOM.render( <QueryParamSelect/>, document.getElementById('query-param-select') ) } }) As a result, I get {} from this.props .
Looking at the official documentation ( https://reactjs.org/docs/components-and-props.html ) I do not quite understand what the problem is. Can you please explain where and what I did wrong?
ReactDom.render, where you don’t get anyprops, where do you get them from? - ThisMan 2:19ReactDom.render? I did this:<QueryParamSelect label="" options={[]} param=""></QueryParamSelect>, but ultimately ignores what I wrote in the back-end framework ... - ColibriReactDOM.renderthat the component with props should be transmitted - ThisMan<queryparamselect (...)></queryparamselect> на строне back-end'а в его шаблоне. Ну и уже в JS файле с помощью<queryparamselect (...)></queryparamselect> на строне back-end'а в его шаблоне. Ну и уже в JS файле с помощьюReactDOM.render` I wanted to "revive" it. I agree that most likely I am doing something wrong, but I do not see how to do it right: ( - Colibri#query-param-select, delete its contents and insert the<QueryParamSelect label="" options={[]} param=""></QueryParamSelect>component . And apparently you just need to find the element, find and “revive” the React components inside it. (I hope clearly described) - Colibri