-
Notifications
You must be signed in to change notification settings - Fork 0
nested components
s1n7ax edited this page Jan 24, 2023
·
1 revision
You can nest as many components as you want.
local Renderer = require('react.renderers.buffer-renderer')
local function Hello()
return {
'Hello'
}
end
local function World()
return {
'World'
}
end
local function Newline()
return {
'\n'
}
end
local function App()
return {
Hello, Newline, World
}
end
local buffer = vim.api.nvim_create_buf(false, true)
local win_conf = {
width = 100,
height = 100,
relative = 'editor',
row = 1,
col = 1,
}
vim.api.nvim_open_win(buffer, true, win_conf)
Renderer:new({
buffer = buffer
}):render(App)