Closed seepine closed 1 year ago
did you follow this? https://github.com/lxsmnsyc/solid-labels#typescript
more over, it seems that you don't have the plugin configured?
did you follow this? https://github.com/lxsmnsyc/solid-labels#typescript
more over, it seems that you don't have the plugin configured?
but it work in tsx
const App: Component = () => {
let count = $signal(1);
const countAdd = () => {
console.log('add', count);
count++;
};
return (
<div>
{count}
<button onClick={countAdd}>countAdd</button>
</div>
);
};
and use vite
export default defineConfig({
plugins: [
solidPlugin(),
solidLabels({
disabled: {
labels: {
signal: true,
},
pragma: {
'@signal': true,
},
ctf: {
$signal: true,
},
},
filter: {
include: 'src/**/*.{ts,js,tsx,jsx}',
exclude: 'node_modules/**/*.{ts,js,tsx,jsx}',
},
}),
]
});
why do you have it disabled though
why do you have it disabled though
sorry, i copy from vite-plugin, and thought this was correct...
now it can run without error, but lost responsiveness, how to use it correctly?
It isn't reactive because of the way you pass count
to the object. You probably want to use $getter
or $get
It isn't reactive because of the way you pass
count
to the object. You probably want to use$getter
or$get
thanks, but maybe i dont know how to use solid-labels, createSignal
look like seems simpler..
import { createSignal } from 'solid-js';
export default () => {
let [count, setCount] = createSignal(1);
const countAdd = () => {
setCount(count() + 1);
};
return {
count,
countAdd,
};
};
import type { Component } from 'solid-js';
import useCount from './use-count';
const App: Component = () => {
const { count, countAdd } = useCount();
return (
<div>
{count}
<button onClick={countAdd}>countAdd</button>
</div>
);
};
export default App;
which is why I would recommend reading the docs. (in the link I provided)
log
code