How to use react-nl2br - 7 common examples

To help you get started, we’ve selected a few react-nl2br examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github developer239 / react-apollo-graphql / src / modules / blog / components / PostsList / index.js View on Github external
{items.map(item => (
      <div>
        <h3>{item.title}</h3>
        <p>{nl2br(item.text)}</p>
        
          <button>
            Detail
          </button>
        
      </div>
    ))}
github notifme / notifme-history / client / components / NotificationList.jsx View on Github external
<div>
                  {(tags || []).map((tag, i) =&gt; (
                    <span>{tag}</span>
                  ))}
                  <span title="{this.getEventsString(events)}">
                    {channel}
                  </span>
                </div>
              
            
            <div>
            <div>
              <a href="{`/notification/${id">
                <h3>{title}</h3>
                <p>{nl2br(text)}</p>
              </a>
            </div>
          
        ))}
      </div>
github developer239 / react-apollo-graphql / src / modules / blog / pages / PostDetail / index.jsx View on Github external
return 
  }

  if (data.error) {
    return 
  }

  return (
    
      
        {data.Post.title}
        
          <small>[edit]</small>
        
      
      <p>{nl2br(data.Post.text)}</p>
    
  )
}
github slidewiki / slidewiki-platform / components / DeckCollection / UserCollections.js View on Github external
content = collections.documents.map( (col) =&gt; {
                    return (
                        <div>
                            <div>
                                <div>
                                    <div><h2><a href="{`/playlist/${col._id}?sort=order`}">{col.title}</a></h2></div>
                                    <div>
                                        <div>{col.decks.length} {this.context.intl.formatMessage((col.decks.length === 1) ? this.messages.deckText : this.messages.decksText)} {(col.userGroup) ? '\u00b7' : ''} {(col.userGroup) ? <i title="{this.context.intl.formatMessage(this.messages.shareCollectionText)}"></i> : ''}</div>
                                        {nl2br(col.description)}
                                    </div>
                                </div>

                                <div>
                                    {(this.props.loggedinUserId === col.user) ? (
                                      <div>
                                          <button aria-label="{this.context.intl.formatMessage(this.messages.collectionDelete)}" data-tooltip="{this.context.intl.formatMessage(this.messages.collectionDelete)}">
                                              <i name="{'deleteCollection_'"></i>
                                          </button>
                                          <button name="{col._id}" aria-label="{this.context.intl.formatMessage(this.messages.collectionSettings)}" data-tooltip="{this.context.intl.formatMessage(this.messages.collectionSettings)}">
                                              <i name="{'editCollection'"></i>
                                          </button>
                                      </div>
                                    ) : ''}
                                </div>
                            </div></div>
github developer239 / react-apollo-graphql / src / modules / blog / components / PostsList / index.jsx View on Github external
{items.map(item =&gt; (
        
          
            <h3>{item.title}</h3>
            <p>{nl2br(item.text)}</p>
            
              <button> prefetchDetail(item.id)} bsStyle="primary"&gt;Detail</button>
            
          
        
      ))}
github luizbatanero / gostack-meetapp / web / src / pages / Meetup / index.js View on Github external
<button type="button">
                  
                  Cancel
                </button>
              
            )}
          

          <main>
            <div>
              <img alt="{meetup.title}" src="{meetup.banner.url}">
            </div>

            <div>
              <p>{nl2br(meetup.description)}</p>
              <footer>
                <div>
                  <p>
                    
                    {meetup.formattedDate}
                  </p>
                  <p>
                    
                    {meetup.location}
                  </p>
                </div>
                {meetup.subscriptions.length &gt;= 1 &amp;&amp; (
                  
                    <div>
                      {meetup.subscriptions.slice(0, 5).map((sub, index) =&gt; (
                        </div></footer></div></main>
github developer239 / react-apollo-graphql / src / pages / Blog / Detail / index.tsx View on Github external
onOk: async () =&gt; {
        try {
          await deletePage({ variables: { id: Number(data.pageDetail.id) } })
          history.push('/')
        } catch (error) {
          await message.error(error.message)
        }
      },
    })
  }

  return (
    <div data-testid="{PAGE_DETAIL_TEST_ID}">
      
        <h1>{data.pageDetail.title}</h1>
        <p>{nl2br(data.pageDetail.text)}</p>
      

      {userData?.me &amp;&amp; userData.me.id === data.pageDetail.user.id &amp;&amp; (
        
          
            <button type="primary" data-testid="{COMPONENT_EDIT_PAGE_TEST_ID}">
              edit page
            </button>
          
          <button type="danger" disabled="{isDeleting}" data-testid="{COMPONENT_DELETE_PAGE_TEST_ID}">
            {isDeleting ? 'deleting page...' : 'delete page'}</button></div>

react-nl2br

newlines like '\n', '\n\r' to <br /> for React

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular react-nl2br functions