<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sneachta O'Fuichtard</title>
    <description>The latest articles on DEV Community by Sneachta O'Fuichtard (@sneachtaof).</description>
    <link>https://dev.to/sneachtaof</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F721003%2Ff16e760f-80cf-48fd-8ef2-64d11c3edbc6.jpeg</url>
      <title>DEV Community: Sneachta O'Fuichtard</title>
      <link>https://dev.to/sneachtaof</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sneachtaof"/>
    <language>en</language>
    <item>
      <title>Is there a better way to get a document icon image in React apart from this lunacy?</title>
      <dc:creator>Sneachta O'Fuichtard</dc:creator>
      <pubDate>Fri, 08 Oct 2021 21:54:25 +0000</pubDate>
      <link>https://dev.to/sneachtaof/is-there-a-better-way-to-get-a-document-icon-image-in-react-apart-from-this-lunacy-38kp</link>
      <guid>https://dev.to/sneachtaof/is-there-a-better-way-to-get-a-document-icon-image-in-react-apart-from-this-lunacy-38kp</guid>
      <description>&lt;p&gt;So I have a Fluent UI DetailsList component in a React SPFx web part and I get it to display the icon through this awful code...&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
constructor(props) {    
    super(props); 
    const columns: IColumn[] = [
      {
        key: 'column1',
        name: 'File Type',
        //className: classNames.fileIconCell,
        //iconClassName: classNames.fileIconHeaderIcon,
        ariaLabel: 'Column operations for File type, Press to sort on File type',
        iconName: 'Page',
        isIconOnly: true,
        fieldName: 'name',
        minWidth: 16,
        maxWidth: 16,
        onColumnClick: this._onColumnClick,
        onRender: (item: IDocument) =&amp;gt; {
          //return &amp;lt;img src={item.iconName} className={classNames.fileIconImg} alt={item.fileType + ' file icon'} /&amp;gt;;
          return &amp;lt;img src={'https://modernb.akamai.odsp.cdn.office.net/files/fabric-cdn-prod_20210703.001/assets/item-types/20/' + item.DocIcon + '.svg'} alt={item.DocIcon + ' file icon'} width='20' height='20' /&amp;gt;;
        },
      },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>typescript</category>
      <category>react</category>
    </item>
    <item>
      <title>Property 'value' does not exist on type 'never'.</title>
      <dc:creator>Sneachta O'Fuichtard</dc:creator>
      <pubDate>Thu, 07 Oct 2021 11:55:19 +0000</pubDate>
      <link>https://dev.to/sneachtaof/property-value-does-not-exist-on-type-never-5b3f</link>
      <guid>https://dev.to/sneachtaof/property-value-does-not-exist-on-type-never-5b3f</guid>
      <description>&lt;p&gt;Hi&lt;/p&gt;

&lt;p&gt;I have some code which works ...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;selectedOptions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;label&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;console.log(value) gives &lt;br&gt;
{value: 'Choice 1', label: 'Choice 1', isInTree: true}&lt;/p&gt;

&lt;p&gt;However if I try to pass "selectedOptions" to a function (code below) it gives an error on &lt;br&gt;
console.log(value.value);&lt;/p&gt;

&lt;p&gt;Saying Property 'value' does not exist on type 'never'.&lt;/p&gt;

&lt;p&gt;Also &lt;br&gt;
console.log('itemIsInSelectedOptions is now:' + value);&lt;br&gt;
gives me ...&lt;br&gt;
itemIsInSelectedOptions is now:[object Object]&lt;/p&gt;

&lt;p&gt;Any ideas?&lt;br&gt;
Thanks &lt;br&gt;
S&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public render(): React.ReactElement&amp;lt;IReactFilteredListProps&amp;gt; {
    const { selectedOptions } = this.state;




this.setState({
        selectedOptions,
        Items: Text ? this._allItems.filter(i =&amp;gt; this.itemIsInSelectedOptions(i.Category, selectedOptions)) : this._allItems
      });

private itemIsInSelectedOptions(theCategory: string, selOpts:[]): boolean
  {

    selOpts.forEach(function (value) {
      console.log('itemIsInSelectedOptions is now:' + value);
      console.log(value.value);
      //console.log(value.label);
    }); 

    return true;
  }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>What does ? : mean in this line of code?</title>
      <dc:creator>Sneachta O'Fuichtard</dc:creator>
      <pubDate>Thu, 07 Oct 2021 10:12:55 +0000</pubDate>
      <link>https://dev.to/sneachtaof/what-does-mean-in-this-line-of-code-59m3</link>
      <guid>https://dev.to/sneachtaof/what-does-mean-in-this-line-of-code-59m3</guid>
      <description>&lt;p&gt;Total newbie here but can someone explain this line of code?&lt;/p&gt;

&lt;p&gt;Items: Text ? this.getFilteredItems(this._allItems) : this._allItems&lt;/p&gt;

&lt;p&gt;Thanks&lt;br&gt;
S&lt;/p&gt;

</description>
      <category>react</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Selecting multiple values and applying them to a DetailsList</title>
      <dc:creator>Sneachta O'Fuichtard</dc:creator>
      <pubDate>Thu, 07 Oct 2021 09:45:37 +0000</pubDate>
      <link>https://dev.to/sneachtaof/selecting-multiple-values-and-applying-them-to-a-detailslist-1f4c</link>
      <guid>https://dev.to/sneachtaof/selecting-multiple-values-and-applying-them-to-a-detailslist-1f4c</guid>
      <description>&lt;p&gt;Hi&lt;br&gt;
I am trying to filter a DetailsList by getting the values from a Select.&lt;/p&gt;

&lt;p&gt;I am able to filter the DetailsList by using hard-coded text but I'd like to be able to loop through the selected options and check for those.&lt;/p&gt;

&lt;p&gt;Thanks&lt;br&gt;
S&lt;/p&gt;

&lt;p&gt;private handleChange = (selectedOptions) =&amp;gt; {  &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  this.setState({

    selectedOptions,
    Items: Text ? this._allItems.filter(i =&amp;gt; i.Category.toLowerCase().indexOf("choice 1") &amp;gt; -1) : this._allItems

  });


selectedOptions.forEach(function (value) {
  console.log(value);
  console.log(value.value);
  console.log(value.label);
}); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}  &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>react</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
