Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@ const App = () => {
const age = profileContext.useSelect((state) => state.age);
const profile = profileContext.useSelect();

const nameField = useField({
initialValue: DEFAULT_PROFILE.name
});

const ageField = useField({
initialValue: DEFAULT_PROFILE.age
});
const nameField = useField(DEFAULT_PROFILE.name);
const ageField = useField(DEFAULT_PROFILE.age);

return (
<div className='rounded-lg p-4'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ const AgeFieldInfo = () => {
};

const Demo = () => {
const nameField = useField({
initialValue: DEFAULT_PROFILE.name
});

const ageField = useField({
initialValue: DEFAULT_PROFILE.age
});
const nameField = useField(DEFAULT_PROFILE.name);
const ageField = useField(DEFAULT_PROFILE.age);

return (
<div className='rounded-lg p-4'>
Expand Down
9 changes: 2 additions & 7 deletions packages/core/src/helpers/createStore/createStore.demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,8 @@ const AgeFieldInfo = () => {
};

const Demo = () => {
const nameField = useField({
initialValue: DEFAULT_PROFILE.name
});

const ageField = useField({
initialValue: DEFAULT_PROFILE.age
});
const nameField = useField(DEFAULT_PROFILE.name);
const ageField = useField(DEFAULT_PROFILE.age);

return (
<div className='rounded-lg p-4'>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/hooks/useMutation/useMutation.demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useField, useList, useMutation } from '@siberiacancode/reactuse';
const createUser = (name: string) => Promise.resolve({ name });

const Demo = () => {
const nameField = useField({ initialValue: '' });
const nameField = useField('');
const userList = useList([{ name: 'John' }]);

const createUserMutation = useMutation(createUser);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/hooks/usePaint/usePaint.demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useState } from 'react';

const Demo = () => {
const [color, setColor] = useState('#37d2e6');
const radiusInput = useField({ initialValue: '10' });
const opacityInput = useField({ initialValue: '1' });
const radiusInput = useField('10');
const opacityInput = useField('1');

const radius = radiusInput.watch();
const opacity = opacityInput.watch();
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/hooks/useSet/useSet.demo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useField, useSet } from '@siberiacancode/reactuse';

const Demo = () => {
const scopeInput = useField({ initialValue: '' });
const scopeInput = useField('');
const scopes = useSet(['@siberiacancode', '@siberiacancode-tests', '@shared']);

return (
Expand All @@ -21,7 +21,7 @@ const Demo = () => {
</div>

<div className='mt-4 flex gap-2'>
{Array.from(scopes.value).map((scope, index) => (
{Array.from(scopes.value, (scope, index) => (
<div key={index} className='cursor-pointer' onClick={() => scopes.remove(scope)}>
<code>{scope}</code>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import { useField, useMount, useSpeechSynthesis } from '@siberiacancode/reactuse
import { useState } from 'react';

const Demo = () => {
const textField = useField({
initialValue: 'Hello, everyone! Good morning!'
});
const pitchField = useField({ initialValue: 1 });
const rateField = useField({ initialValue: 1 });
const textField = useField('Hello, everyone! Good morning!');
const pitchField = useField(1);
const rateField = useField(1);
const [voices, setVoices] = useState<SpeechSynthesisVoice[]>([]);
const [voice, setVoice] = useState<SpeechSynthesisVoice>();

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/hooks/useWebSocket/useWebSocket.demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface Message {
}

const Demo = () => {
const messageInput = useField({ initialValue: '' });
const messageInput = useField('');

const [messages, setMessages] = useState<Message[]>([
{ text: 'Connecting to chat...', type: 'server', date: new Date() }
Expand Down