Skip to content

Instantly share code, notes, and snippets.

@andersonFaro9
andersonFaro9 / actions.tsx
Created October 29, 2024 14:14
na lista de ações, cada card deve clicar no coração para favoritar ou não, como tornar o botão de coração de favoritar dinâmico sem que todos sejam selecionados de uma única vez?
import React from 'react'
import {
View,
ScrollView,
StyleSheet,
Image,
Switch,
TouchableOpacity,
TouchableHighlight,
TouchableWithoutFeedback,
const bcrypt = require("bcrypt");
const db = require("../models");
const jwt = require("jsonwebtoken");
const User = db.users;
const signup = async (req, res)=> {
try {
const {userName, password, email} = req.body;
const data = {
function searchBinary(arrays, item) {
let baixo = 1
let alto = (arrays - 1)
if(baixo <= alto) {
let meio = (baixo + alto)/ 2
let chute = arrays[meio]
if (chute == item) {
return meio
}
if(chute > item) {
// app.js
import Clock from './deps/clock.js';
import View from './views.js';
const view = new View();
const clock = new Clock()
let took = ''
view.configureOnFileChange (file=> {
package com.example.crud.controllers;
import com.example.crud.domain.product.Product;
import com.example.crud.domain.product.ProductRepository;
import com.example.crud.domain.product.RequestProductDTO;
import jakarta.persistence.EntityNotFoundException;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import { useEffect, useState } from 'react'
import {api} from './api/api'
interface IDescription {
description:string;
id:string;
}
import { Injectable } from '@nestjs/common';
import { PrismaService } from '../services/prisma.service';
import { BooksDto } from './../booksDto/books.dto';
@Injectable()
export class BooksService {
constructor(private prisma: PrismaService) {}
async create(data: BooksDto) {
import Head from 'next/head'
import Image from 'next/image'
import { useEffect, useState } from 'react';
import {api} from './api/api'
interface IBooks {
id:string;
title:string;
author:string;
year:string;
//fazendo a interface entender que devo trazer dados de um array
const [books, setBook] = useState<IBooks[]>([]);
//na chamada da lista(ul) estava colocado a chamada do map errado mas corrigir dessa forma:
{books.map((item) => (
<li key={item.id}>
{item.title}
</li>
))} //coloquei as chaves e parentenses de forma correta
import Head from 'next/head'
import Image from 'next/image'
import { useEffect, useState } from 'react';
import {api} from './api/api'
interface IBooks {
title: string;
}
export default function Home() {