Categories
Cryptocurrency Ethereum Mastering Development

Drizzle cacheSend outputs “cacheSend is not a function” error, but the tx works when using send

I’m using Drizzle and react-hooks in my new open source project, but cacheSend outputs always “cacheSend is not a function” This line of code with send works as expected const stackId = contract.methods.createMerchant(value.name, value.category, value.weburl).send({from: drizzleState.accounts[0]}) Instead using cacheSend returns an error “cacheSend is not a function” const stackId = contract.methods[“createMerchant”].cacheSend(value.name, value.category, value.weburl, { from: […]

Categories
Mastering Development

How do I use react custom hooks to make code reusable

I have two components similar like below: const Login = props => { let loading; const dispatch = useDispatch(); const [notification, setNotification] = React.useState(”); const [hasNotification, setHasNotification] = React.useState(”); const [isLoading, setIsLoading] = React.useState(false); const {status, message} = useSelector(state => state.LoginReducer); const { register, handleSubmit, formState, errors } = useForm({ mode: “onChange” }); const onSubmit […]

Categories
Mastering Development

How to send data in a JSON format to an HTTP End Point from a custom web page?

I have created a simple custom web page using HTML and JavaScript, that allows a user to select multiple languages of their choice to translate text. For example, lets say the user chooses English(en-US) and French(fr-FR) and clicks on “Submit”. I want to take the user’s request, and send that data to an Azure Logic […]

Categories
Development

How to reset a certains fields after submit in Formik

I am using Formik and I need to make this logic. I am have a big form, and after submission I need to reset certain fields in this form There is 2 buttton: Save and Save & New save will save the data and redirect. Save & New will save the data and reset the […]

Categories
Development

How to dispatch from react-hook-form + Redux

I’m using react-hook-form (https://react-hook-form.com/). I would like to dispatch action from inside of react-hook-form. In following case, I am supposed to dispatch using props.dispatch, when onSubmit is fired. However I could not figure out how to dispatch. import React from ‘react’ import useForm from ‘react-hook-form’ export default function App() { const { register, handleSubmit, watch, […]

Categories
Development

How to compose react-hook-form into component

I’m trying to use react-hook-form (https://react-hook-form.com/) first time. I don’t know how to compose them into react components with redux. import React from ‘react’ import useForm from ‘react-hook-form’ export default function SampleForm() { const { register, handleSubmit, watch, errors } = useForm() const onSubmit = data => { console.log(data) } console.log(watch(‘example’)) // watch input value […]