0
How do I place json data within the "recipes[]" array that is in the state?
import recipes from '../receitas/recipes.json'
constructor(props) {
super(props);
this.recipes = recipes.results; //json dinâmico local
this.state = {
receitas: [],
searchString: ''
};
}
componentDidMount(){
this.loadReceitas();
}
loadReceitas = async () => {
const recipesList = await this.props.recipes.results;
this.setState({ receitas: recipesList.recipes.results });
}
From now on I thank anyone who can help me.