Categories
Mastering Development

Use Material-UI HOC in Class Component

I’m trying to use material UI in my class component, instead of converting everything to Hooks. I’m not sure which method is easier, Hooks or retro-fitting what I have. Here’s my code: class App extends Component { constructor(props) { super(props); this.state = { hits: [], desc: [], }; } componentDidMount() { this.fetchData(); } fetchData() { […]

Categories
Development

I want to convert this Flatlist react native code into a class file. Can anyone help me to find out the solution?

**this code is in running state you can run it on snack.expo.io or on your own pc** import React from ‘react’; import { SafeAreaView, TouchableOpacity, FlatList, StyleSheet, Text, } from ‘react-native’; const DATA = [ { id: ‘1’, title: ‘First Item’, }, { id: ‘2’, title: ‘Second Item’, }, { id: ‘3’, title: ‘Third Item’, […]