Skip to Content
Phoenix Web Development
book

Phoenix Web Development

by Brandon Richey
April 2018
Beginner to intermediate content levelBeginner to intermediate
406 pages
9h 33m
English
Packt Publishing
Content preview from Phoenix Web Development

Imports and exports

import statements can work in two ways; either through working with default imports or named imports. Looking at the example we wrote for the first line:

import { Socket } from 'phoenix';

This is an example of a named import. Anything we put in brackets will be a named import. In this case, we're looking for something that was exported from the Phoenix library as "socket". This is usually the case when there are multiple exports in a single file or library. The corresponding export might look something like this:

// This is not the actual code, just an example of how this could looklet Socket = {};export { Socket };

This is the way that we're going to be able to work with other libraries and how we're going to be able ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Phoenix in Action

Phoenix in Action

Geoffrey Lessel
Real-Time Phoenix

Real-Time Phoenix

Stephen Bussey

Publisher Resources

ISBN: 9781787284197Supplemental Content