Can I use JSX as a return for the gantt.templates.task_text function?
const Div = () => <div>test</div>
gantt.templates.task_text = function(start,end,task){
return <Div/>
};
Can I use JSX as a return for the gantt.templates.task_text function?
const Div = () => <div>test</div>
gantt.templates.task_text = function(start,end,task){
return <Div/>
};
Hi,
If you add this code to the js file with the implementation of the component (Gantt.js in our demo) - that wouldn’t work.
While you are working with JSX - you must also use a compiler (for example babel, gulp, webpack etc.) that transforms JSX to JS. If you do that - the provided code should work correctly.
I’m not official. And I have the same question you asked.
But according to below post, render React in task_text seems not possible. The answer says the React component only supported in the grid and in the task layer.