Category: Project

https://cdn3d.iconscout.com/3d/premium/thumb/list-project-management-3d-icon-download-in-png-blend-fbx-gltf-file-formats–document-clipboard-pack-business-icons-5888926.png?f=webp

  • ReactHaven

    Setting Up Your Environment

    If you haven’t set up a React project yet, you can use Create React App:

    bashCopy codenpx create-react-app react-haven
    cd react-haven
    

    Step 2: Create Basic Components

    We’ll create three main components: NoteList, AddNote, and NoteItem.

    1. Create NoteItem.js

    In the src folder, create a new file called NoteItem.js:

    jsxCopy code// src/NoteItem.js
    import React from 'react';
    
    const NoteItem = ({ note, onDelete }) => {
      return (
    
    <div style={styles.noteItem}>
      <p>{note}</p>
      <button onClick={onDelete}>Delete</button>
    </div>
    ); }; const styles = { noteItem: {
    border: '1px solid #ccc',
    borderRadius: '5px',
    padding: '10px',
    margin: '5px 0',
    }, }; export default NoteItem;

    2. Create NoteList.js

    Now create another file called NoteList.js:

    jsxCopy code// src/NoteList.js
    import React from 'react';
    import NoteItem from './NoteItem';
    
    const NoteList = ({ notes, onDelete }) => {
      return (
    
    <div>
      {notes.map((note, index) => (
        <NoteItem
          key={index}
          note={note}
          onDelete={() => onDelete(index)}
        />
      ))}
    </div>
    ); }; export default NoteList;

    3. Create AddNote.js

    Next, create the AddNote.js component for adding notes:

    jsxCopy code// src/AddNote.js
    import React, { useState } from 'react';
    
    const AddNote = ({ onAdd }) => {
      const [note, setNote] = useState('');
    
      const handleSubmit = (e) => {
    
    e.preventDefault();
    if (note) {
      onAdd(note);
      setNote('');
    }
    }; return (
    <form onSubmit={handleSubmit}>
      <input
        type="text"
        value={note}
        onChange={(e) => setNote(e.target.value)}
        placeholder="Add a new note"
      />
      <button type="submit">Add Note</button>
    </form>
    ); }; export default AddNote;

    Step 4: Main Application Component

    Now, let’s integrate everything in App.js.

    jsxCopy code// src/App.js
    import React, { useState } from 'react';
    import AddNote from './AddNote';
    import NoteList from './NoteList';
    
    const App = () => {
      const [notes, setNotes] = useState([]);
    
      const addNote = (note) => {
    
    setNotes([...notes, note]);
    }; const deleteNote = (index) => {
    const newNotes = notes.filter((_, i) => i !== index);
    setNotes(newNotes);
    }; return (
    <div style={styles.container}>
      <h1>ReactHaven: Note Taking App</h1>
      <AddNote onAdd={addNote} />
      <NoteList notes={notes} onDelete={deleteNote} />
    </div>
    ); }; const styles = { container: {
    padding: '20px',
    textAlign: 'center',
    }, }; export default App;

    Step 5: Run Your Application

    Now you can start your application. In your terminal, run:

    bashCopy codenpm start
    

    Step 6: Explore and Enhance

    You now have a basic React application called “ReactHaven” that allows you to manage a list of notes. You can enhance it by adding features like:

    • Editing notes
    • Categorizing notes by color or tag
    • Storing notes in local storage for persistence

    Summary

    In this tutorial, you created a simple note-taking app using React. You learned how to manage state, create reusable components, and handle user interactions.

  • FusionFrame

    Setting Up Your Environment

    If you haven’t set up a React project yet, use Create React App:

    bashCopy codenpx create-react-app fusion-frame
    cd fusion-frame
    

    Step 2: Create Basic Components

    We’ll create three main components: PhotoGallery, UploadPhoto, and PhotoItem.

    1. Create PhotoItem.js

    In the src folder, create a new file called PhotoItem.js:

    jsxCopy code// src/PhotoItem.js
    import React from 'react';
    
    const PhotoItem = ({ photo, onDelete }) => {
      return (
    
    <div style={styles.photoItem}>
      <img src={photo.url} alt={photo.name} style={styles.image} />
      <button onClick={onDelete}>Delete</button>
    </div>
    ); }; const styles = { photoItem: {
    margin: 10,
    display: 'inline-block',
    textAlign: 'center',
    }, image: {
    width: 150,
    height: 150,
    objectFit: 'cover',
    }, }; export default PhotoItem;

    2. Create UploadPhoto.js

    Now create another file called UploadPhoto.js:

    jsxCopy code// src/UploadPhoto.js
    import React, { useState } from 'react';
    
    const UploadPhoto = ({ onUpload }) => {
      const [file, setFile] = useState(null);
    
      const handleChange = (e) => {
    
    setFile(e.target.files[0]);
    }; const handleSubmit = (e) => {
    e.preventDefault();
    if (file) {
      const reader = new FileReader();
      reader.onloadend = () => {
        onUpload({ name: file.name, url: reader.result });
        setFile(null);
      };
      reader.readAsDataURL(file);
    }
    }; return (
    <form onSubmit={handleSubmit}>
      <input type="file" onChange={handleChange} accept="image/*" />
      <button type="submit">Upload Photo</button>
    </form>
    ); }; export default UploadPhoto;

    3. Create PhotoGallery.js

    Next, create the main gallery component PhotoGallery.js:

    jsxCopy code// src/PhotoGallery.js
    import React from 'react';
    import PhotoItem from './PhotoItem';
    
    const PhotoGallery = ({ photos, onDelete }) => {
      return (
    
    <div style={styles.gallery}>
      {photos.map((photo, index) => (
        <PhotoItem
          key={index}
          photo={photo}
          onDelete={() => onDelete(index)}
        />
      ))}
    </div>
    ); }; const styles = { gallery: {
    display: 'flex',
    flexWrap: 'wrap',
    justifyContent: 'center',
    }, }; export default PhotoGallery;

    Step 4: Main Application Component

    Now, let’s integrate everything in App.js.

    jsxCopy code// src/App.js
    import React, { useState } from 'react';
    import UploadPhoto from './UploadPhoto';
    import PhotoGallery from './PhotoGallery';
    
    const App = () => {
      const [photos, setPhotos] = useState([]);
    
      const uploadPhoto = (photo) => {
    
    setPhotos([...photos, photo]);
    }; const deletePhoto = (index) => {
    const newPhotos = photos.filter((_, i) => i !== index);
    setPhotos(newPhotos);
    }; return (
    <div style={styles.container}>
      <h1>FusionFrame: Photo Gallery</h1>
      <UploadPhoto onUpload={uploadPhoto} />
      <PhotoGallery photos={photos} onDelete={deletePhoto} />
    </div>
    ); }; const styles = { container: {
    padding: '20px',
    textAlign: 'center',
    }, }; export default App;

    Step 5: Run Your Application

    Now you can start your application. In your terminal, run:

    bashCopy codenpm start
    

    Step 6: Explore and Enhance

    You now have a basic React application called “FusionFrame” that allows you to upload and manage a gallery of photos. You can enhance it by adding features like:

    • Image previews before uploading
    • Categorizing photos
    • Storing photos in local storage for persistence

    Summary

    In this tutorial, you created a simple photo gallery app using React. You learned how to manage state, create reusable components, and handle file uploads.

  • CodeCompass

    Setting Up Your Environment

    If you haven’t set up a React project yet, you can use Create React App:

    bashCopy codenpx create-react-app code-compass
    cd code-compass
    

    Step 2: Create Basic Components

    We’ll create two main components: ProjectList and AddProject.

    1. Create ProjectList.js

    In the src folder, create a new file called ProjectList.js:

    jsxCopy code// src/ProjectList.js
    import React from 'react';
    
    const ProjectList = ({ projects, onDelete }) => {
      return (
    
    <ul>
      {projects.map((project, index) => (
        <li key={index}>
          {project.name} - {project.description}
          <button onClick={() => onDelete(index)}>Delete</button>
        </li>
      ))}
    </ul>
    ); }; export default ProjectList;

    2. Create AddProject.js

    Now create another file called AddProject.js:

    jsxCopy code// src/AddProject.js
    import React, { useState } from 'react';
    
    const AddProject = ({ onAdd }) => {
      const [name, setName] = useState('');
      const [description, setDescription] = useState('');
    
      const handleSubmit = (e) => {
    
    e.preventDefault();
    if (name && description) {
      onAdd({ name, description });
      setName('');
      setDescription('');
    }
    }; return (
    <form onSubmit={handleSubmit}>
      <input
        type="text"
        value={name}
        onChange={(e) => setName(e.target.value)}
        placeholder="Project Name"
      />
      <input
        type="text"
        value={description}
        onChange={(e) => setDescription(e.target.value)}
        placeholder="Project Description"
      />
      <button type="submit">Add Project</button>
    </form>
    ); }; export default AddProject;

    Step 3: Main Application Component

    Now, let’s integrate everything in App.js.

    jsxCopy code// src/App.js
    import React, { useState } from 'react';
    import ProjectList from './ProjectList';
    import AddProject from './AddProject';
    
    const App = () => {
      const [projects, setProjects] = useState([]);
    
      const addProject = (project) => {
    
    setProjects([...projects, project]);
    }; const deleteProject = (index) => {
    const newProjects = projects.filter((_, i) => i !== index);
    setProjects(newProjects);
    }; return (
    <div>
      <h1>CodeCompass: Project Manager</h1>
      <AddProject onAdd={addProject} />
      <ProjectList projects={projects} onDelete={deleteProject} />
    </div>
    ); }; export default App;

    Step 4: Run Your Application

    Now you can start your application. In your terminal, run:

    bashCopy codenpm start
    

    Step 5: Explore and Enhance

    You now have a basic React application called “CodeCompass” that allows you to manage a list of coding projects. You can enhance it by adding features like:

    • Editing project details
    • Filtering projects by category or status
    • Persisting project data in local storage

    Summary

    In this tutorial, you created a simple project manager app using React. You learned how to manage state, create reusable components, and handle user interactions.

  • ReactRealm

    Setting Up Your Environment

    1. Create a New React AppUse Create React App to set up your project:bashCopy codenpx create-react-app react-realm cd react-realm
    2. Install RealmYou’ll need to install the Realm database package:bashCopy codenpm install realm

    Step 2: Create the Realm Schema

    First, we need to define our data model. Create a new file called Book.js in the src folder to define the Realm schema:

    javascriptCopy code// src/Book.js
    import Realm from 'realm';
    
    class Book {
      static schema = {
    
    name: 'Book',
    properties: {
      id: 'int',
      title: 'string',
      author: 'string',
    },
    primaryKey: 'id',
    }; } export default Book;

    Step 3: Create Basic Components

    We’ll create two main components: BookList and AddBook.

    1. Create BookList.js

    In the src folder, create a new file called BookList.js:

    javascriptCopy code// src/BookList.js
    import React from 'react';
    import { View, Text, FlatList, StyleSheet, Button } from 'react-native';
    
    const BookList = ({ books, onDelete }) => {
      return (
    
    <FlatList
      data={books}
      keyExtractor={(item) => item.id.toString()}
      renderItem={({ item }) => (
        <View style={styles.itemContainer}>
          <Text style={styles.itemText}>
            {item.title} by {item.author}
          </Text>
          <Button title="Delete" onPress={() => onDelete(item.id)} />
        </View>
      )}
    />
    ); }; const styles = StyleSheet.create({ itemContainer: {
    padding: 15,
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    borderBottomWidth: 1,
    borderBottomColor: '#ccc',
    }, itemText: {
    fontSize: 18,
    }, }); export default BookList;

    2. Create AddBook.js

    Now create another file called AddBook.js:

    javascriptCopy code// src/AddBook.js
    import React, { useState } from 'react';
    import { View, TextInput, Button, StyleSheet } from 'react-native';
    
    const AddBook = ({ onAdd }) => {
      const [title, setTitle] = useState('');
      const [author, setAuthor] = useState('');
    
      const handleSubmit = () => {
    
    if (title && author) {
      onAdd({ title, author });
      setTitle('');
      setAuthor('');
    }
    }; return (
    <View style={styles.container}>
      <TextInput
        style={styles.input}
        placeholder="Book Title"
        value={title}
        onChangeText={setTitle}
      />
      <TextInput
        style={styles.input}
        placeholder="Author"
        value={author}
        onChangeText={setAuthor}
      />
      <Button title="Add Book" onPress={handleSubmit} />
    </View>
    ); }; const styles = StyleSheet.create({ container: {
    marginBottom: 20,
    }, input: {
    borderWidth: 1,
    borderColor: '#ccc',
    padding: 10,
    marginBottom: 10,
    }, }); export default AddBook;

    Step 4: Main Application Component

    Now, let’s integrate everything in App.js.

    javascriptCopy code// src/App.js
    import React, { useState, useEffect } from 'react';
    import { View, Text, StyleSheet } from 'react-native';
    import Realm from 'realm';
    import Book from './Book';
    import BookList from './BookList';
    import AddBook from './AddBook';
    
    const App = () => {
      const [books, setBooks] = useState([]);
      const realm = new Realm({ schema: [Book] });
    
      useEffect(() => {
    
    const loadBooks = () => {
      const storedBooks = realm.objects('Book');
      setBooks(Array.from(storedBooks));
    };
    loadBooks();
    }, []); const addBook = ({ title, author }) => {
    realm.write(() => {
      const newBook = realm.create('Book', {
        id: realm.objects('Book').length + 1,
        title,
        author,
      });
      setBooks((prevBooks) => [...prevBooks, newBook]);
    });
    }; const deleteBook = (id) => {
    realm.write(() => {
      const bookToDelete = realm.objectForPrimaryKey('Book', id);
      if (bookToDelete) {
        realm.delete(bookToDelete);
        setBooks((prevBooks) => prevBooks.filter((book) => book.id !== id));
      }
    });
    }; return (
    <View style={styles.container}>
      <Text style={styles.title}>ReactRealm: Book Manager</Text>
      <AddBook onAdd={addBook} />
      <BookList books={books} onDelete={deleteBook} />
    </View>
    ); }; const styles = StyleSheet.create({ container: {
    flex: 1,
    padding: 20,
    backgroundColor: '#fff',
    }, title: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 20,
    }, }); export default App;

    Step 5: Run Your Application

    Now you can start your application. In your terminal, run:

    bashCopy codenpm start
    

    This command will open a new tab in your browser, allowing you to run the app on an emulator or your physical device using Expo Go app.

    Summary

    In this tutorial, you created a simple book manager app using Realm for data persistence. You learned how to manage state, create reusable components, and interact with a local database.

    Feel free to enhance the application with additional features, such as:

    • Editing book details
    • Searching for books
    • Adding categories or tags
  • Nativator

    Setting Up Your Environment

    Make sure you have Node.js and npm installed. We will use Expo for easy React Native development.

    1. Install Expo CLI if you haven’t already:bashCopy codenpm install -g expo-cli
    2. Create a new project:bashCopy codeexpo init Nativator cd Nativator
    3. Choose the “blank” template when prompted.

    Step 2: Create Basic Components

    We will create two main components: PlantList and AddPlant.

    1. Create PlantList.js

    In the components folder (create it if it doesn’t exist), create a new file called PlantList.js:

    jsxCopy code// components/PlantList.js
    import React from 'react';
    import { View, Text, FlatList, StyleSheet, Button } from 'react-native';
    
    const PlantList = ({ plants, onDelete }) => {
      return (
    
    <FlatList
      data={plants}
      keyExtractor={(item, index) => index.toString()}
      renderItem={({ item, index }) => (
        <View style={styles.itemContainer}>
          <Text style={styles.itemText}>{item}</Text>
          <Button title="Delete" onPress={() => onDelete(index)} />
        </View>
      )}
    />
    ); }; const styles = StyleSheet.create({ itemContainer: {
    padding: 15,
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    borderBottomWidth: 1,
    borderBottomColor: '#ccc',
    }, itemText: {
    fontSize: 18,
    }, }); export default PlantList;

    2. Create AddPlant.js

    Now create another file called AddPlant.js:

    jsxCopy code// components/AddPlant.js
    import React, { useState } from 'react';
    import { View, TextInput, Button, StyleSheet } from 'react-native';
    
    const AddPlant = ({ onAdd }) => {
      const [inputValue, setInputValue] = useState('');
    
      const handleSubmit = () => {
    
    if (inputValue) {
      onAdd(inputValue);
      setInputValue('');
    }
    }; return (
    <View style={styles.container}>
      <TextInput
        style={styles.input}
        placeholder="Add a new native plant"
        value={inputValue}
        onChangeText={setInputValue}
      />
      <Button title="Add" onPress={handleSubmit} />
    </View>
    ); }; const styles = StyleSheet.create({ container: {
    flexDirection: 'row',
    marginVertical: 20,
    }, input: {
    borderWidth: 1,
    borderColor: '#ccc',
    flex: 1,
    padding: 10,
    marginRight: 10,
    }, }); export default AddPlant;

    Step 3: Main Application Component

    Now, let’s integrate everything in App.js.

    jsxCopy code// App.js
    import React, { useState } from 'react';
    import { View, Text, StyleSheet } from 'react-native';
    import PlantList from './components/PlantList';
    import AddPlant from './components/AddPlant';
    
    const App = () => {
      const [plants, setPlants] = useState([]);
    
      const addPlant = (plant) => {
    
    setPlants([...plants, plant]);
    }; const deletePlant = (index) => {
    const newPlants = plants.filter((_, i) => i !== index);
    setPlants(newPlants);
    }; return (
    <View style={styles.container}>
      <Text style={styles.title}>Nativator: Native Plant Manager</Text>
      <AddPlant onAdd={addPlant} />
      <PlantList plants={plants} onDelete={deletePlant} />
    </View>
    ); }; const styles = StyleSheet.create({ container: {
    flex: 1,
    padding: 20,
    backgroundColor: '#fff',
    }, title: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 20,
    }, }); export default App;

    Step 4: Run Your Application

    Now you can start your application. In your terminal, run:

    bashCopy codeexpo start
    

    This command will open a new tab in your browser, allowing you to run the app on an emulator or your physical device using the Expo Go app.

    Step 5: Explore and Enhance

    You now have a basic React Native application called “Nativator” that allows you to manage a list of native plants. You can enhance it by adding features like:

    • Editing plant names
    • Categorizing plants by type
    • Storing plants in local storage for persistence

    Summary

    In this tutorial, you created a simple plant manager app with React Native. You learned how to manage state, create reusable components, and handle user interactions.

  • PixelPioneer

    Setting Up Your Environment

    If you haven’t set up a React project yet, you can use Create React App:

    bashCopy codenpx create-react-app pixel-pioneer
    cd pixel-pioneer
    

    Step 2: Create Basic Components

    We will create two main components: ArtList and AddArt.

    1. Create ArtList.js

    In the src folder, create a new file called ArtList.js:

    jsxCopy code// src/ArtList.js
    import React from 'react';
    
    const ArtList = ({ artProjects, onDelete }) => {
      return (
    
    <ul>
      {artProjects.map((art, index) => (
        <li key={index}>
          {art}
          <button onClick={() => onDelete(index)}>Delete</button>
        </li>
      ))}
    </ul>
    ); }; export default ArtList;

    2. Create AddArt.js

    Now create another file called AddArt.js:

    jsxCopy code// src/AddArt.js
    import React, { useState } from 'react';
    
    const AddArt = ({ onAdd }) => {
      const [inputValue, setInputValue] = useState('');
    
      const handleSubmit = (e) => {
    
    e.preventDefault();
    if (inputValue) {
      onAdd(inputValue);
      setInputValue('');
    }
    }; return (
    <form onSubmit={handleSubmit}>
      <input
        type="text"
        value={inputValue}
        onChange={(e) => setInputValue(e.target.value)}
        placeholder="Add a new pixel art project"
      />
      <button type="submit">Add</button>
    </form>
    ); }; export default AddArt;

    Step 3: Main Application Component

    Now, let’s integrate everything in App.js.

    jsxCopy code// src/App.js
    import React, { useState } from 'react';
    import ArtList from './ArtList';
    import AddArt from './AddArt';
    
    const App = () => {
      const [artProjects, setArtProjects] = useState([]);
    
      const addArt = (art) => {
    
    setArtProjects([...artProjects, art]);
    }; const deleteArt = (index) => {
    const newArtProjects = artProjects.filter((_, i) => i !== index);
    setArtProjects(newArtProjects);
    }; return (
    <div>
      <h1>PixelPioneer: Pixel Art Manager</h1>
      <AddArt onAdd={addArt} />
      <ArtList artProjects={artProjects} onDelete={deleteArt} />
    </div>
    ); }; export default App;

    Step 4: Run Your Application

    Now you can start your application. In your terminal, run:

    bashCopy codenpm start
    

    Step 5: Explore and Enhance

    You now have a basic React application called “PixelPioneer” that allows you to manage a list of pixel art projects. You can enhance it by adding features like:

    • Editing art project names
    • Adding categories or tags for each project
    • Storing projects in local storage for persistence

    Summary

    In this tutorial, you created a simple project manager app for pixel art with React. You learned how to manage state, create reusable components, and handle user interactions.

  • AppSynergy

    Setting Up Your Environment

    If you haven’t set up a React project yet, you can use Create React App:

    bashCopy codenpx create-react-app app-synergy
    cd app-synergy
    

    Step 2: Create Basic Components

    We will create two main components: TaskList and AddTask.

    1. Create TaskList.js

    In the src folder, create a new file called TaskList.js:

    jsxCopy code// src/TaskList.js
    import React from 'react';
    
    const TaskList = ({ tasks, onDelete }) => {
      return (
    
    <ul>
      {tasks.map((task, index) => (
        <li key={index}>
          {task}
          <button onClick={() => onDelete(index)}>Delete</button>
        </li>
      ))}
    </ul>
    ); }; export default TaskList;

    2. Create AddTask.js

    Now create another file called AddTask.js:

    jsxCopy code// src/AddTask.js
    import React, { useState } from 'react';
    
    const AddTask = ({ onAdd }) => {
      const [inputValue, setInputValue] = useState('');
    
      const handleSubmit = (e) => {
    
    e.preventDefault();
    if (inputValue) {
      onAdd(inputValue);
      setInputValue('');
    }
    }; return (
    <form onSubmit={handleSubmit}>
      <input
        type="text"
        value={inputValue}
        onChange={(e) => setInputValue(e.target.value)}
        placeholder="Add a new task"
      />
      <button type="submit">Add</button>
    </form>
    ); }; export default AddTask;

    Step 3: Main Application Component

    Now, let’s integrate everything in App.js.

    jsxCopy code// src/App.js
    import React, { useState } from 'react';
    import TaskList from './TaskList';
    import AddTask from './AddTask';
    
    const App = () => {
      const [tasks, setTasks] = useState([]);
    
      const addTask = (task) => {
    
    setTasks([...tasks, task]);
    }; const deleteTask = (index) => {
    const newTasks = tasks.filter((_, i) => i !== index);
    setTasks(newTasks);
    }; return (
    <div>
      <h1>AppSynergy: Task Manager</h1>
      <AddTask onAdd={addTask} />
      <TaskList tasks={tasks} onDelete={deleteTask} />
    </div>
    ); }; export default App;

    Step 4: Run Your Application

    Now you can start your application. In your terminal, run:

    bashCopy codenpm start
    

    Step 5: Explore and Enhance

    You now have a basic React application called “AppSynergy” that allows you to manage a list of tasks. You can enhance it by adding features like:

    • Editing tasks
    • Marking tasks as complete
    • Storing tasks in local storage for persistence

    Summary

    In this tutorial, you created a simple task manager app with React. You learned how to manage state, create reusable components, and handle user interactions.

  • CrossPlatformer

    Setting Up Your Environment

    Make sure you have Node.js and npm installed. We’ll use Expo for easy cross-platform development.

    1. Install Expo CLI if you haven’t already:bashCopy codenpm install -g expo-cli
    2. Create a new project:bashCopy codeexpo init CrossPlatformer cd CrossPlatformer
    3. Choose the “blank” template when prompted.

    Step 2: Create Basic Components

    We will create two main components: HobbyList and AddHobby.

    1. Create HobbyList.js

    In the components folder (create it if it doesn’t exist), create a new file called HobbyList.js:

    jsxCopy code// components/HobbyList.js
    import React from 'react';
    import { View, Text, FlatList, StyleSheet, Button } from 'react-native';
    
    const HobbyList = ({ hobbies, onDelete }) => {
      return (
    
    <FlatList
      data={hobbies}
      keyExtractor={(item, index) => index.toString()}
      renderItem={({ item, index }) => (
        <View style={styles.itemContainer}>
          <Text style={styles.itemText}>{item}</Text>
          <Button title="Delete" onPress={() => onDelete(index)} />
        </View>
      )}
    />
    ); }; const styles = StyleSheet.create({ itemContainer: {
    padding: 15,
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    borderBottomWidth: 1,
    borderBottomColor: '#ccc',
    }, itemText: {
    fontSize: 18,
    }, }); export default HobbyList;

    2. Create AddHobby.js

    Now create another file called AddHobby.js:

    jsxCopy code// components/AddHobby.js
    import React, { useState } from 'react';
    import { View, TextInput, Button, StyleSheet } from 'react-native';
    
    const AddHobby = ({ onAdd }) => {
      const [inputValue, setInputValue] = useState('');
    
      const handleSubmit = () => {
    
    if (inputValue) {
      onAdd(inputValue);
      setInputValue('');
    }
    }; return (
    <View style={styles.container}>
      <TextInput
        style={styles.input}
        placeholder="Add a new hobby"
        value={inputValue}
        onChangeText={setInputValue}
      />
      <Button title="Add" onPress={handleSubmit} />
    </View>
    ); }; const styles = StyleSheet.create({ container: {
    flexDirection: 'row',
    marginVertical: 20,
    }, input: {
    borderWidth: 1,
    borderColor: '#ccc',
    flex: 1,
    padding: 10,
    marginRight: 10,
    }, }); export default AddHobby;

    Step 3: Main Application Component

    Now, let’s integrate everything in App.js.

    jsxCopy code// App.js
    import React, { useState } from 'react';
    import { View, Text, StyleSheet } from 'react-native';
    import HobbyList from './components/HobbyList';
    import AddHobby from './components/AddHobby';
    
    const App = () => {
      const [hobbies, setHobbies] = useState([]);
    
      const addHobby = (hobby) => {
    
    setHobbies([...hobbies, hobby]);
    }; const deleteHobby = (index) => {
    const newHobbies = hobbies.filter((_, i) => i !== index);
    setHobbies(newHobbies);
    }; return (
    <View style={styles.container}>
      <Text style={styles.title}>CrossPlatformer: Hobby Manager</Text>
      <AddHobby onAdd={addHobby} />
      <HobbyList hobbies={hobbies} onDelete={deleteHobby} />
    </View>
    ); }; const styles = StyleSheet.create({ container: {
    flex: 1,
    padding: 20,
    backgroundColor: '#fff',
    }, title: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 20,
    }, }); export default App;

    Step 4: Run Your Application

    Start your application using:

    bashCopy codeexpo start
    

    This command will open a new tab in your browser, allowing you to run the app on an emulator or your physical device using the Expo Go app. You can also run it on the web by selecting the web option in the Expo interface.

    Summary

    In this tutorial, you created a simple cross-platform app called “CrossPlatformer” that allows users to manage a list of hobbies. You learned how to handle state, create reusable components, and work with React Native, which can be run on both mobile and web.

    Feel free to enhance the application with features like:

    • Editing hobbies
    • Persisting data using AsyncStorage
    • Adding categories for hobbies
  • ReactRoot

    Setting Up Your Environment

    If you haven’t set up a React project yet, you can use Create React App:

    bashCopy codenpx create-react-app react-root
    cd react-root
    

    Step 2: Create Basic Components

    We will create two main components: TaskList and AddTask.

    1. Create TaskList.js

    In the src folder, create a new file called TaskList.js:

    jsxCopy code// src/TaskList.js
    import React from 'react';
    
    const TaskList = ({ tasks, onDelete }) => {
      return (
    
    <ul>
      {tasks.map((task, index) => (
        <li key={index}>
          {task}
          <button onClick={() => onDelete(index)}>Delete</button>
        </li>
      ))}
    </ul>
    ); }; export default TaskList;

    2. Create AddTask.js

    Now create another file called AddTask.js:

    jsxCopy code// src/AddTask.js
    import React, { useState } from 'react';
    
    const AddTask = ({ onAdd }) => {
      const [inputValue, setInputValue] = useState('');
    
      const handleSubmit = (e) => {
    
    e.preventDefault();
    if (inputValue) {
      onAdd(inputValue);
      setInputValue('');
    }
    }; return (
    <form onSubmit={handleSubmit}>
      <input
        type="text"
        value={inputValue}
        onChange={(e) => setInputValue(e.target.value)}
        placeholder="Add a new task"
      />
      <button type="submit">Add</button>
    </form>
    ); }; export default AddTask;

    Step 3: Main Application Component

    Now, let’s integrate everything in App.js.

    jsxCopy code// src/App.js
    import React, { useState } from 'react';
    import TaskList from './TaskList';
    import AddTask from './AddTask';
    
    const App = () => {
      const [tasks, setTasks] = useState([]);
    
      const addTask = (task) => {
    
    setTasks([...tasks, task]);
    }; const deleteTask = (index) => {
    const newTasks = tasks.filter((_, i) => i !== index);
    setTasks(newTasks);
    }; return (
    <div>
      <h1>ReactRoot: Task Manager</h1>
      <AddTask onAdd={addTask} />
      <TaskList tasks={tasks} onDelete={deleteTask} />
    </div>
    ); }; export default App;

    Step 4: Run Your Application

    Now you can start your application. In your terminal, run:

    bashCopy codenpm start
    

    Step 5: Explore and Enhance

    You now have a basic React application called “ReactRoot” that allows you to manage a list of tasks. You can enhance it by adding features like:

    • Editing tasks
    • Marking tasks as complete
    • Persisting tasks in local storage

    Summary

    In this tutorial, you created a simple task manager app with React. You learned how to manage state, create reusable components, and handle user interactions.

  • MobileMuse

    Setting Up Your Environment

    Make sure you have Node.js and npm installed. We will use Expo to create our React Native app.

    1. Install Expo CLI if you haven’t already:bashCopy codenpm install -g expo-cli
    2. Create a new project:bashCopy codeexpo init MobileMuse cd MobileMuse
    3. Choose a blank template when prompted.

    Step 2: Create Basic Components

    We’ll create two main components: IdeaList and AddIdea.

    1. Create IdeaList.js

    In the components folder (create it if it doesn’t exist), create a new file called IdeaList.js:

    jsxCopy code// components/IdeaList.js
    import React from 'react';
    import { View, Text, FlatList, StyleSheet } from 'react-native';
    
    const IdeaList = ({ ideas }) => {
      return (
    
    <FlatList
      data={ideas}
      keyExtractor={(item, index) => index.toString()}
      renderItem={({ item }) => (
        <View style={styles.itemContainer}>
          <Text style={styles.itemText}>{item}</Text>
        </View>
      )}
    />
    ); }; const styles = StyleSheet.create({ itemContainer: {
    padding: 15,
    borderBottomWidth: 1,
    borderBottomColor: '#ccc',
    }, itemText: {
    fontSize: 18,
    }, }); export default IdeaList;

    2. Create AddIdea.js

    Now create another file called AddIdea.js:

    jsxCopy code// components/AddIdea.js
    import React, { useState } from 'react';
    import { View, TextInput, Button, StyleSheet } from 'react-native';
    
    const AddIdea = ({ onAdd }) => {
      const [inputValue, setInputValue] = useState('');
    
      const handleSubmit = () => {
    
    if (inputValue) {
      onAdd(inputValue);
      setInputValue('');
    }
    }; return (
    <View style={styles.container}>
      <TextInput
        style={styles.input}
        placeholder="Add a new idea"
        value={inputValue}
        onChangeText={setInputValue}
      />
      <Button title="Add" onPress={handleSubmit} />
    </View>
    ); }; const styles = StyleSheet.create({ container: {
    flexDirection: 'row',
    marginVertical: 20,
    }, input: {
    borderWidth: 1,
    borderColor: '#ccc',
    flex: 1,
    padding: 10,
    marginRight: 10,
    }, }); export default AddIdea;

    Step 3: Main Application Component

    Now, let’s integrate everything in App.js.

    jsxCopy code// App.js
    import React, { useState } from 'react';
    import { View, Text, StyleSheet } from 'react-native';
    import IdeaList from './components/IdeaList';
    import AddIdea from './components/AddIdea';
    
    const App = () => {
      const [ideas, setIdeas] = useState([]);
    
      const addIdea = (idea) => {
    
    setIdeas([...ideas, idea]);
    }; return (
    <View style={styles.container}>
      <Text style={styles.title}>MobileMuse: Idea Manager</Text>
      <AddIdea onAdd={addIdea} />
      <IdeaList ideas={ideas} />
    </View>
    ); }; const styles = StyleSheet.create({ container: {
    flex: 1,
    padding: 20,
    backgroundColor: '#fff',
    }, title: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 20,
    }, }); export default App;

    Step 4: Run Your Application

    Start your application using:

    bashCopy codeexpo start
    

    This command will open a new tab in your browser, allowing you to run the app on an emulator or your physical device using the Expo Go app.

    Summary

    In this tutorial, you created a simple React Native app called “MobileMuse” that allows users to add and manage creative ideas. You learned how to manage state and create reusable components in React Native.

    Feel free to enhance the application by adding features like:

    • Removing ideas
    • Editing ideas
    • Storing data with AsyncStorage for persistence