How can the input value be enclosed in a variable?

I’m trying to create a component that will have an input and a button. In input, the user enters his nickname. This nickname, that is, the input value, must be stored in a variable. This variable is needed for a function that creates a link to which the user will be redirected by the button.

My component (next.js)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>'use client'
import { Button } from '@nextui-org/react';
import Link from 'next/link';
import React, { useState } from 'react';
let inputValue: any;
let setInputValue: any;
const InputComponent = () => {
[inputValue, setInputValue] = useState('');
const handleInputChange = (event: any) => {
setInputValue(event.target.value);
};
return (
<div className='flex flex-col gap-2'>
<input id='areaNick' type="text" value={inputValue} onChange={handleInputChange} placeholder='Введите никнейм' className='bg-transparent border-b-2 border-blue-300 text-white placeholder:text-blue-300 focus:outline-none' />
<Button radius="lg" className='bg-white text-blue-500 uppercase font-semibold' type="submit" as={Link} href="https://cubeinside.easydonate.ru/">Купить</Button>
<p>{inputValue}</p>
</div>
);
};
export default InputComponent;
</code>
<code>'use client' import { Button } from '@nextui-org/react'; import Link from 'next/link'; import React, { useState } from 'react'; let inputValue: any; let setInputValue: any; const InputComponent = () => { [inputValue, setInputValue] = useState(''); const handleInputChange = (event: any) => { setInputValue(event.target.value); }; return ( <div className='flex flex-col gap-2'> <input id='areaNick' type="text" value={inputValue} onChange={handleInputChange} placeholder='Введите никнейм' className='bg-transparent border-b-2 border-blue-300 text-white placeholder:text-blue-300 focus:outline-none' /> <Button radius="lg" className='bg-white text-blue-500 uppercase font-semibold' type="submit" as={Link} href="https://cubeinside.easydonate.ru/">Купить</Button> <p>{inputValue}</p> </div> ); }; export default InputComponent; </code>
'use client'

import { Button } from '@nextui-org/react';
import Link from 'next/link';
import React, { useState } from 'react';

let inputValue: any;
let setInputValue: any;

const InputComponent = () => {
  [inputValue, setInputValue] = useState('');

  const handleInputChange = (event: any) => {
    setInputValue(event.target.value);
  };

  return (
    <div className='flex flex-col gap-2'>
        <input id='areaNick' type="text" value={inputValue} onChange={handleInputChange} placeholder='Введите никнейм' className='bg-transparent border-b-2 border-blue-300 text-white placeholder:text-blue-300 focus:outline-none' />
        <Button radius="lg" className='bg-white text-blue-500 uppercase font-semibold' type="submit" as={Link} href="https://cubeinside.easydonate.ru/">Купить</Button>
        <p>{inputValue}</p>
    </div>
  );
};

export default InputComponent;

Function

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>client.getPaymentLink(customer, serverID, products, url, email, coupon).then((link) => console.log('link ', link));
</code>
<code>client.getPaymentLink(customer, serverID, products, url, email, coupon).then((link) => console.log('link ', link)); </code>
client.getPaymentLink(customer, serverID, products, url, email, coupon).then((link) => console.log('link ', link));

All function variables are constant, except for the “customer” and “email” variables. I get the email from the session, but the “customer” should take the value from input. The problem is that the function that reads the value from the input requires the client component, but the function that generates the link does not work in the client component. How can I transfer a variable from a client component to a server component, or how can I place this function in a client component.

I searched the internet for how to declare a variable globally for the entire project, but it uses functions that the client component requires, and in my case it doesn’t work.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật