小编Bru*_*lda的帖子

如何使用映射或循环使用React JS渲染图像?

这是我的js文件,其中包含我的图像.

import React, { Component } from 'react';
import './Stopka.css';

class Stopka extends Component {
    render() {
        return (
            <div className="container">
                <footer className="row">
                    <div className="col-xs-12 col-sm-6 col-md-6 col-lg-6">
                        <h4>Some text</h4>
                    </div>
                    <div className="col-xs-12 col-sm-6 col-md-6 col-lg-6">
                        <img src={require("./icons/name1.png")} alt="" className="img-responsive" />
                        <img src={require("./icons/name2.png")} alt="" className="img-responsive" />
                        <img src={require("./icons/name3.png")} alt="" className="img-responsive" />
                        <img src={require("./icons/name4.png")} alt="" className="img-responsive" />
                    </div>
                </footer>
            </div>
        );
    }
}
export default Stopka;
Run Code Online (Sandbox Code Playgroud)

和渲染这个的文件.

import React from 'react';
import ReactDOM from 'react-dom';
import Stopka from './Stopka';
import registerServiceWorker …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs

10
推荐指数
1
解决办法
2万
查看次数

如何使用 lodash 检查另一个数组中的数组值

我的查询过滤器

export const resolvers = {
    Query: {
        allItems: (_, { value }) => getAllLinks()
            .then(result => filter(result, val => val.custom_attributes
                .find(customVal =>
                    customVal.attribute_code === 'category_ids' && isEqual(customVal.value, value)
                )
                )),
    },
Run Code Online (Sandbox Code Playgroud)

我的架构

const typeDefs = `
    type Item  {
        id: ID!
        name: String
        price: Float
        custom_attributes: [CUSTOM_ATTRIBUTES]
    }

    union CUSTOM_ATTRIBUTES = CustomString | CustomArray 

   type CustomString {
    attribute_code: String
    value: String
  }

  type CustomArray {
    attribute_code: String
    value: [String]

  } 

  type Query {
    allItems(value : [String]): [Item]!

  }
`; …
Run Code Online (Sandbox Code Playgroud)

javascript lodash graphql

1
推荐指数
1
解决办法
4097
查看次数

标签 统计

javascript ×2

graphql ×1

lodash ×1

reactjs ×1