///
import React, { useState } from 'react';
import { createContainer } from '@react-telegram/core';
// Create container and render
const { container, render, clickButton } = createContainer();
console.log('Initial render:');
// Example usage
const App = () => {
const [count, setCount] = useState(0);
return (
<>
Welcome to Telegram React!
Current count: {count}
This is a custom React reconciler that renders to structured data
suitable for Telegram's message format.
>
);
};
console.log('Initial render');
render();
container.onRenderContainer = (root) => {
console.log('onRenderContainer called');
console.log(JSON.stringify(root, null, 2));
};
setTimeout(() => {
console.log('\nClicking increase (0-1)');
clickButton('0-1');
setTimeout(() => {
console.log('\nClicking decrease (0-0)');
clickButton('0-0');
}, 10);
}, 10);