0

я новичок в React, я не понимаю как передать useState и props одному компоненту вот код:

<PopupWithForm name="edit" id="Edit" title="Редактировать профиль" active={popActive} setActive={setPopActive}/>

function PopupWithForm({active, setActive},props){
...
 } 

1 ответ 1

0
const PopupWithForm = ({ active, setActive, name, id, title }) => {...}

или

const PopupWithForm = (props) => {
 const { active, setActive, name, id, title } = props;
...
}

без стрелочной функции все то же самое:

function PopupWithForm ({ active, setActive, name, id, title }) {...}

или

function PopupWithForm (props) {
 const { active, setActive, name, id, title } = props;
...
}

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.