Reputation: 130
i Created the native module and module.export function calling after every 3 min so i can split audio, but i want to call this updateState function, How can i call updateState function.
import React, { useEffect, useState } from 'react';
import {
Text
} from 'react-native';
module.exports = async (taskData) => {
updateState({})
}
const myTask = () => {
const updateState = () => {}
return (<Text>Hello</Text>)
};
export default myTask;
Upvotes: 0
Views: 560
Reputation: 306
You have to use the useEffect
hook provided by react.
import React, { useEffect } from 'react';
const myTask = () => {
useEffect(() => {
updateState()
});
return (<Text>Hello</Text>)
};
export default myTask;
https://en.reactjs.org/docs/hooks-effect.html check the doc here.
Upvotes: 1